Html Listbox Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sunny

    Html Listbox Question

    Hi,

    How I can move to the first value in Listbox.
    I have a listbox that has some values.
    When I select any value from it. It opens a div with the info about
    that value.
    But when I click on close Button of that div & div goes away. and I
    select the same value again.
    The div dont appear.
    Is there anyway, I can make the listbox value to show the first entry,
    when I click on Close div button.
  • David Mark

    #2
    Re: Html Listbox Question

    On Oct 9, 10:46 am, Sunny <sunnyluth...@g mail.comwrote:
    Hi,
    >
    How I can move to the first value in Listbox.
    Pardon?
    I have a listbox that has some values.
    Okay.
    When I select any value from it. It opens a div with the info about
    that value.
    Have to take your word for it. You click, it "opens a div."
    But when I click on close Button of that div & div goes away. and I
    Where is this div (and the code that goes with it?)
    select the same value again.
    The div dont appear.
    Okay.
    Is there anyway, I can make the listbox value to show the first entry,
    when I click on Close div button.
    Is there any way you could post some (if not all) of the offending
    code.

    Comment

    • Sunny

      #3
      Re: Html Listbox Question

      On Oct 9, 10:51 am, David Mark <dmark.cins...@ gmail.comwrote:
      On Oct 9, 10:46 am, Sunny <sunnyluth...@g mail.comwrote:
      >
      Hi,
      >
      How I can move to the first value in Listbox.
      >
      Pardon?
      >
      I have a listbox that has some values.
      >
      Okay.
      >
      When I select any value from it. It opens a div with the info about
      that value.
      >
      Have to take your word for it. You click, it "opens a div."
      >
      But when I click on close Button of that div & div goes away. and I
      >
      Where is this div (and the code that goes with it?)
      >
      select the same value again.
      The div dont appear.
      >
      Okay.
      >
      Is there anyway, I can make the listbox value to show the first entry,
      when I click on Close div button.
      >
      Is there any way you could post some (if not all) of the offending
      code.
      Sorry for that:
      Here is the code:
      function OnChange(dropdo wn)
      {

      myindex =
      dropdown.select edIndex //This
      assigns the combobox index to a variable.
      var SelValue =
      dropdown.option s[myindex].value //This
      assigns the combobox index value to a variable.
      if (document.getEl ementById("deta ilsPopup").styl e.display ==
      "none") //If the detailsPopup is not showing on the map show it.
      {
      document.getEle mentById("detai lsPopup").style .display = "block";
      }
      if (document.getEl ementById("deta ilsPopup2").sty le.display ==
      "none")
      {
      document.getEle mentById("detai lsPopup2").styl e.display = "block";
      }
      }

      This is a function to close the div.

      function closeDiv()
      {
      if (document.getEl ementById("deta ilsPopup2").sty le.display == "block")
      {
      document.getEle mentById("detai lsPopup2").styl e.display = "none";
      }
      if (document.getEl ementById("deta ilsPopup").styl e.display == "block")
      {
      document.getEle mentById("detai lsPopup").style .display = "none";
      }
      }

      Comment

      • sasuke

        #4
        Re: Html Listbox Question

        On Oct 9, 7:54 pm, Sunny <sunnyluth...@g mail.comwrote:
        On Oct 9, 10:51 am, David Mark <dmark.cins...@ gmail.comwrote:
        >
        >
        >
        On Oct 9, 10:46 am, Sunny <sunnyluth...@g mail.comwrote:
        >
        Hi,
        >
        How I can move to the first value in Listbox.
        >
        Pardon?
        >
        I have a listbox that has some values.
        >
        Okay.
        >
        When I select any value from it. It opens a div with the info about
        that value.
        >
        Have to take your word for it.  You click, it "opens a div."
        >
        But when I click on close Button of that div & div goes away. and I
        >
        Where is this div (and the code that goes with it?)
        >
        select the same value again.
        The div dont appear.
        >
        Okay.
        >
        Is there anyway, I can make the listbox value to show the first entry,
        when I click on Close div button.
        >
        Is there any way you could post some (if not all) of the offending
        code.
        >
        Sorry for that:
        Here is the code:
        function OnChange(dropdo wn)
        {
        >
            myindex  =
        dropdown.select edIndex                                   //This
        assigns the combobox index to a variable.
            var SelValue =
        dropdown.option s[myindex].value                          //This
        assigns the combobox index value to a variable.
                                         if (document.getEl ementById("deta ilsPopup").styl e.display ==
        "none")  //If the detailsPopup is not showing on the map show it.
                                         {
                                         document.getEle mentById("detai lsPopup").style .display = "block";
                                         }
                 if (document.getEl ementById("deta ilsPopup2").sty le.display ==
        "none")
                                         {
                                         document.getEle mentById("detai lsPopup2").styl e.display = "block";
                                         }
        >
        }
        >
        This is a function to close the div.
        >
        function closeDiv()
        {
        if (document.getEl ementById("deta ilsPopup2").sty le.display == "block")
                                 {
                document.getEle mentById("detai lsPopup2").styl e.display = "none";
                         }
        if (document.getEl ementById("deta ilsPopup").styl e.display == "block")
                                 {
                                         document.getEle mentById("detai lsPopup").style .display = "none";
                         }
                }
        Honor the 80 char limit along with replacing tabs with spaces when
        posting code. Posting something along the lines of a SSCCE <http://
        mindprod.com/jgloss/sscce.htmlwould help the others in pinpointing
        the issue with minimalistic effort.

        As for your issue, just invoke the function which you would invoke
        when a list item is clicked with the argument as the value of the list
        item[assuming you have designed your application in a modular way with
        separate function to handle the show/hide of DIV based on the value
        passed].

        /sasuke

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: Html Listbox Question

          Sunny wrote:
          On Oct 9, 10:51 am, David Mark <dmark.cins...@ gmail.comwrote:
          >On Oct 9, 10:46 am, Sunny <sunnyluth...@g mail.comwrote:
          >>Is there anyway, I can make the listbox value to show the first entry,
          >>when I click on Close div button.
          >Is there any way you could post some (if not all) of the offending
          ^^^^^^^^^
          >code.
          ^^^^
          Sorry for that:
          Here is the code:
          function OnChange(dropdo wn)
          {
          >
          myindex =
          dropdown.select edIndex //This
          assigns the combobox index to a variable.
          var SelValue =
          dropdown.option s[myindex].value //This
          assigns the combobox index value to a variable.
          if (document.getEl ementById("deta ilsPopup").styl e.display ==
          [...]
          That's *offending* code for sure.


          SCNR

          PointedEars


          P.S.: <http://jibbering.com/faq/#FAQ2_3>
          --
          Anyone who slaps a 'this page is best viewed with Browser X' label on
          a Web page appears to be yearning for the bad old days, before the Web,
          when you had very little chance of reading a document written on another
          computer, another word processor, or another network. -- Tim Berners-Lee

          Comment

          • David Mark

            #6
            Re: Html Listbox Question

            On Oct 9, 10:54 am, Sunny <sunnyluth...@g mail.comwrote:
            On Oct 9, 10:51 am, David Mark <dmark.cins...@ gmail.comwrote:
            >
            >
            >
            On Oct 9, 10:46 am, Sunny <sunnyluth...@g mail.comwrote:
            >
            Hi,
            >
            How I can move to the first value in Listbox.
            >
            Pardon?
            >
            I have a listbox that has some values.
            >
            Okay.
            >
            When I select any value from it. It opens a div with the info about
            that value.
            >
            Have to take your word for it.  You click, it "opens a div."
            >
            But when I click on close Button of that div & div goes away. and I
            >
            Where is this div (and the code that goes with it?)
            >
            select the same value again.
            The div dont appear.
            >
            Okay.
            >
            Is there anyway, I can make the listbox value to show the first entry,
            when I click on Close div button.
            >
            Is there any way you could post some (if not all) of the offending
            code.
            >
            Sorry for that:
            Here is the code:
            function OnChange(dropdo wn)
            {
            >
                myindex  =
            dropdown.select edIndex                                   //This
            assigns the combobox index to a variable.
                var SelValue =
            dropdown.option s[myindex].value                          //This
            assigns the combobox index value to a variable.
                                             if (document.getEl ementById("deta ilsPopup").styl e.display ==
            "none")  //If the detailsPopup is not showing on the map show it.
                                             {
                                             document.getEle mentById("detai lsPopup").style .display = "block";
                                             }
                     if (document.getEl ementById("deta ilsPopup2").sty le.display ==
            "none")
                                             {
                                             document.getEle mentById("detai lsPopup2").styl e.display = "block";
                                             }
            >
            }
            >
            This is a function to close the div.
            >
            function closeDiv()
            {
            if (document.getEl ementById("deta ilsPopup2").sty le.display == "block")
                                     {
                    document.getEle mentById("detai lsPopup2").styl e.display = "none";
                             }
            if (document.getEl ementById("deta ilsPopup").styl e.display == "block")
                                     {
                                             document.getEle mentById("detai lsPopup").style .display = "none";
                             }
                    }
            If I understand your original post (not sure I do), it looks to me
            like you have made some bad design decisions. I would add a "Details"
            button to display the DIV. The change event is for updating the
            states of other inputs on the form. It isn't for validation,
            navigation or pop-up messages.

            And never do this:

            document.getEle mentById("detai lsPopup").style .display = "none"

            Always test the return value of gEBID before usage. Yes, if you
            substitute "$" for "document.getEl ementById", you have the archetypal
            pattern used by code-re-arrangers (e.g. users of Prototype, jQuery,
            etc.) That confirms it as poison.

            Comment

            Working...