473,795 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1584
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.
Oct 9 '08 #2
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";
}
}
Oct 9 '08 #3
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.getEl ementById("deta ilsPopup").styl e.display = "block";
* * * * * * * * * * * * * * * * *}
* * * * *if (document.getEl ementById("deta ilsPopup2").sty le.display ==
"none")
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getEl ementById("deta ilsPopup2").sty le.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.getEl ementById("deta ilsPopup").styl e.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
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...@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
Oct 9 '08 #5
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.getEl ementById("deta ilsPopup").styl e.display = "block";
* * * * * * * * * * * * * * * * *}
* * * * *if (document.getEl ementById("deta ilsPopup2").sty le.display ==
"none")
* * * * * * * * * * * * * * * * *{
* * * * * * * * * * * * * * * * *document.getEl ementById("deta ilsPopup2").sty le.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.getEl ementById("deta ilsPopup").styl e.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.
Oct 9 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2496
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 'Button19' of type 'Button' must be placed inside a form tag with runat=server Can the IDE not do what it is supposed to do. It seems that it is a fight to make it do anything or did I do something wrong? It would seem silly to have to create a...
3
6106
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 the list back to the database. First of all, I implemented the re-ordering through client-side javascript, which worked great (also it didn't require a postback every time an item was re-ordered). For testing purposes, I'm outputting the contents...
2
1598
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 where it does list it). So when I create my asp:ListBox and try to set SelectedValue=(to a databind value) it has a squiggly line under it and says 'not recognised property of list box'. The thing is, it works, so i have ignored it, but I would...
0
1586
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 is empty initially .the two buttons which i have taken are both(btnAd,btnRemove) have values Add,Remove and both are input type with run as server control property set to true,.my script is given below , however when i click on add button the ...
21
2272
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 different text after the object has already been added.
3
8900
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 Me.ListBoxPerson.Items.AddRange(ary)
0
1539
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 that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
0
1405
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 that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
2
1795
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 previously created listboxes to populate. These listboxes are each linked to ranges of cells that appear or are blanked out by IF statements in excel formulas =IF(a1=1,"company name","") - the contents of cell A1 becomes 1 based on an affirmative response...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10164
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.