my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes How to make this work in IE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to make this work in IE? " Watch "How to make this work in IE? " New topic

How to make this work in IE?

Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
I have a selection box like this:

I want to retrieve the level value based on an event

This works on Firefox:

or even


None of them work in IE. How can I make it work in IE?

Thanks million.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

Should work. What is happening?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
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:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<script type="text/javascript">
function goAlert(level){

<form id="FormName" action="(EmptyReference!)" method="get" name="FormName">
<table width="495" border="0" cellspacing="0" cellpadding="2" bgcolor="white">

<td bgcolor="#d0eaf6" width="95">
<div align="right">
<p style="font-family: verdana; font-size: 10px"><b>* Level:</b></p>
<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>


<td colspan="2" bgcolor="#d0eaf6" width="487">
<div align="center">
<input type="submit" name="submitButtonName"/></div>

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
um, how about ONCHANGE in the select element. You can not by event handlers in the option tags.

jQuery in Action, 2nd edition
subject: How to make this work in IE?
Similar Threads
innerHTML with drop down box not working with IE
problem with multi select box with horizontal scroll bar
Firefox doesn't show background color for selected option
How to disable an option within select dropdown in IE
Script using array