SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Javascript and dropdown menu
-
Dec 27, 2006, 12:34 #1
- Join Date
- Oct 2006
- Posts
- 77
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Javascript and dropdown menu
Hello,
Im am trying to create a drop down menu script. Once they select the item from the drop down box, it used javascript to update a div.
I am also using PHP, to get the items from a database to build the form.
My Code:
Code:<? $listrooms = mysql_query("SELECT * FROM `chat_rooms` WHERE `title` != ''") or die(mysql_error()); ?> <form name="pickroom"> <select name="chooseform" onchange="UpdateRoom(document.pickroom.chooseform);"> <? while($chatroom=mysql_fetch_array($listrooms)){ if(!$chatroom[title]) { } else { echo '<option value="'.$chatroom[id].'">'.$chatroom[title].'</option>'; //echo '<a href="#" onclick="UpdateRoom('.$chatroom[id].'); return false;" title="Add to Favorites">'.$chatroom[title].'</a> <br />'; } } ?> </select> </form>
I tried onchange as you can see.
Any help? Thanks?
-
Dec 27, 2006, 14:45 #2
- Join Date
- Oct 2005
- Location
- South Dakota
- Posts
- 215
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
well you need to supply us with all the code if you want good help...
onchange="UpdateRoom(document.pickroom.chooseform);"
that will work (not in all browsers though) aslong as UpdateRoom() actually is a function defined somewhere else.
Supply us with either a link to the site in action or all the code... even just an html dump would work fine.
-ALLDid I help you?
You can repay me, support one of my projects (no money needed):
JavaScript Wiki, Another Web Forum, Paranormal Site
-
Dec 27, 2006, 21:30 #3
- Join Date
- Oct 2005
- Location
- South Dakota
- Posts
- 215
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
your problem is here:
Code:var uRoomurl="room.php?id="+room
Code:...onchange="UpdateRoom(document.pickroom.chooseform);"...
Code:...onchange="UpdateRoom(this.value);"...
Did I help you?
You can repay me, support one of my projects (no money needed):
JavaScript Wiki, Another Web Forum, Paranormal Site
Bookmarks