473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

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.
Oct 9 '08 #1
5 1571
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
3
by: Stimp | last post by:
I have a listbox of values that I populate from a database. I want the user to be able to re-order the list (by first selecting an item and then clicking 'up' or 'down' buttons) and then save...
2
by: louise raisbeck | last post by:
Hi there. I am a little confused. SelectedValue is a property of ListBox and dropdownlist. However it isnt in the list of properties in intellisence (html view i am not talking about code behind...
0
by: deepak | last post by:
Hi all, i m transefering values from one listbox to another listbox using javascript(both are html controls), the first listbox is populating with database at page_load time and the second listbox...
21
by: Bilal Abbasi | last post by:
I realize that you can add items to a list box as objects so you can have access to more than just one property like the itemindex in vb6. Question I have is how do I cause the listbox to show a...
3
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C...
0
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box...
0
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box...
2
by: dan NY | last post by:
I'm a struggling new VB Applications user that has what may be a simple question, but I've been struggling with it. I'm using a response to a message box YesNo question to cause one of two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.