By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,831 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,831 IT Pros & Developers. It's quick & easy.

Html Listbox Question

P: n/a
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.
Oct 9 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Oct 9, 10:46 am, Sunny <sunnyluth...@gmail.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.
Oct 9 '08 #2

P: n/a
On Oct 9, 10:51 am, David Mark <dmark.cins...@gmail.comwrote:
On Oct 9, 10:46 am, Sunny <sunnyluth...@gmail.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(dropdown)
{

myindex =
dropdown.selectedIndex //This
assigns the combobox index to a variable.
var SelValue =
dropdown.options[myindex].value //This
assigns the combobox index value to a variable.
if (document.getElementById("detailsPopup").style.dis play ==
"none") //If the detailsPopup is not showing on the map show it.
{
document.getElementById("detailsPopup").style.disp lay = "block";
}
if (document.getElementById("detailsPopup2").style.di splay ==
"none")
{
document.getElementById("detailsPopup2").style.dis play = "block";
}
}

This is a function to close the div.

function closeDiv()
{
if (document.getElementById("detailsPopup2").style.di splay == "block")
{
document.getElementById("detailsPopup2").style.dis play = "none";
}
if (document.getElementById("detailsPopup").style.dis play == "block")
{
document.getElementById("detailsPopup").style.disp lay = "none";
}
}
Oct 9 '08 #3

P: n/a
On Oct 9, 7:54*pm, Sunny <sunnyluth...@gmail.comwrote:
On Oct 9, 10:51 am, David Mark <dmark.cins...@gmail.comwrote:
On Oct 9, 10:46 am, Sunny <sunnyluth...@gmail.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(dropdown)
{

* * myindex *=
dropdown.selectedIndex * * * * * * * * * * * * * * * * * //This
assigns the combobox index to a variable.
* * var SelValue =
dropdown.options[myindex].value * * * * * * * * * * * * *//This
assigns the combobox index value to a variable.
* * * * * * * * * * * * * * * * *if (document.getElementById("detailsPopup").style.dis play ==
"none") *//If the detailsPopup is not showing on the map show it.
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup").style.dis play = "block";
* * * * * * * * * * * * * * * * *}
* * * * *if (document.getElementById("detailsPopup2").style.di splay ==
"none")
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup2").style.di splay = "block";
* * * * * * * * * * * * * * * * *}

}

This is a function to close the div.

function closeDiv()
{
if (document.getElementById("detailsPopup2").style.di splay == "block")
* * * * * * * * * * * * *{
* * * * document.getElementById("detailsPopup2").style.dis play = "none";
* * * * * * * * *}
if (document.getElementById("detailsPopup").style.dis play == "block")
* * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup").style.dis play = "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
Oct 9 '08 #4

P: n/a
Sunny wrote:
On Oct 9, 10:51 am, David Mark <dmark.cins...@gmail.comwrote:
>On Oct 9, 10:46 am, Sunny <sunnyluth...@gmail.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(dropdown)
{

myindex =
dropdown.selectedIndex //This
assigns the combobox index to a variable.
var SelValue =
dropdown.options[myindex].value //This
assigns the combobox index value to a variable.
if (document.getElementById("detailsPopup").style.dis play ==
[...]
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
Oct 9 '08 #5

P: n/a
On Oct 9, 10:54*am, Sunny <sunnyluth...@gmail.comwrote:
On Oct 9, 10:51 am, David Mark <dmark.cins...@gmail.comwrote:
On Oct 9, 10:46 am, Sunny <sunnyluth...@gmail.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(dropdown)
{

* * myindex *=
dropdown.selectedIndex * * * * * * * * * * * * * * * * * //This
assigns the combobox index to a variable.
* * var SelValue =
dropdown.options[myindex].value * * * * * * * * * * * * *//This
assigns the combobox index value to a variable.
* * * * * * * * * * * * * * * * *if (document.getElementById("detailsPopup").style.dis play ==
"none") *//If the detailsPopup is not showing on the map show it.
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup").style.dis play = "block";
* * * * * * * * * * * * * * * * *}
* * * * *if (document.getElementById("detailsPopup2").style.di splay ==
"none")
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup2").style.di splay = "block";
* * * * * * * * * * * * * * * * *}

}

This is a function to close the div.

function closeDiv()
{
if (document.getElementById("detailsPopup2").style.di splay == "block")
* * * * * * * * * * * * *{
* * * * document.getElementById("detailsPopup2").style.dis play = "none";
* * * * * * * * *}
if (document.getElementById("detailsPopup").style.dis play == "block")
* * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getElementById("detailsPopup").style.dis play = "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.getElementById("detailsPopup").style.disp lay = "none"

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

This discussion thread is closed

Replies have been disabled for this discussion.