| Author |
How to make this work in IE?
|
Richard Vagner
Ranch Hand
Joined: Jun 26, 2001
Posts: 106
|
|
I have a selection box like this: I want to retrieve the level value based on an event This works on Firefox: level=document.FormName.level.selectedIndex alert(level); or even level=document.getElementById("level").value; alert(level); None of them work in IE. How can I make it work in IE? Thanks million.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56172
|
|
|
Should work. What is happening?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Richard Vagner
Ranch Hand
Joined: Jun 26, 2001
Posts: 106
|
|
Thanks Bear, I realize this portion of the code is not working in IE but works in Firefox: <option value="1" onMouseDown="goAlert(1)">Level 1</option> I want the click on the option to trigger goAlert(). Any workaround? Thanks a lot. This is the testing code: <code> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function goAlert(level){ alert(level); } </script> </head> <body> <form id="FormName" action="(EmptyReference!)" method="get" name="FormName"> <table width="495" border="0" cellspacing="0" cellpadding="2" bgcolor="white"> <tr> <td bgcolor="#d0eaf6" width="95"> <div align="right"> <p style="font-family: verdana; font-size: 10px"><b>* Level:</b></p> </div> </td> <td bgcolor="#d0eaf6" width="150"> <select name="level" id="level" size="1"> <option value="">Select</option> <option value="1" onMouseDown="goAlert(1)">Level 1</option> <option value="2" onMouseDown="goAlert(2)">Level 2</option> <option value="3" onMouseDown="goAlert(3)">Level 3</option> <option value="4" onMouseDown="goAlert(4)">Level 4</option> </select></td> </tr> <tr> <td colspan="2" bgcolor="#d0eaf6" width="487"> <div align="center"> <input type="submit" name="submitButtonName"/></div> </td> </tr> </table> </form> </body> </html> </code>
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
um, how about ONCHANGE in the select element. You can not by event handlers in the option tags. Eric
|
 |
 |
|
|
subject: How to make this work in IE?
|
|
|