Tech Support Forum banner
Status
Not open for further replies.
1 - 2 of 2 Posts

· Registered
Joined
·
2 Posts
Discussion Starter · #1 ·
Hi,

Anyone can help me getting this thing to work in IE (no matter which version)?
It works like a charm in FireFox.

Apparently, OnMouseOver-events on an <option>-tag aren't supported in IE.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
<!--
function swapImage(newImage){    
	var img = document.getElementById('blank');    
	img.setAttribute('src', newImage);
}
//-->
</script>
</head>

<body>
<font face="Arial, Helvetica, sans-serif"> 
<table width="90%" border="1" align="center" cellpadding="2" id="products">
  <tr> 
    <td colspan="3" align="center" valign="middle"> 
      <div align="center"><img src="blank.jpg" name="blank" width="200" height="200" id="blank"></div></td>
  </tr>
  <tr> 
    <td width="33%"> <div align="center"><strong>Products</strong></div></td>
    <td width="33%"> <div align="center"><strong></strong></div></td>
    <td width="33%"> <div align="center"><strong></strong></div></td>
  </tr>
  <tr> 
    <td width="33%"> <div align="center"> 
        <select name="products" id="products">
          <option selected>Please select from below.......</option>
          <option onMouseOver="swapImage('machines/prod1.jpg')" onMouseOut="swapImage('blank.jpg')">Product 1</option>
        </select>
      </div></td>
    <td width="33%"> <div align="center"></div></td>
    <td width="33%"> <div align="center"></div></td>
  </tr>
</table>
</font>
</body>
</html>
Any suggestions will be appreciated... :pray:
 

· Registered
Joined
·
30 Posts
I am unable to get this to work in Firefox either. But for a different reason.

You are trying to grab an element with getElementById() only a NAME set. Get by ID grabs an element with a specific ID not NAME.

As for IE... No I do not think IE supports events on the option tag. Depending on what you are trying to accomplish, you could use the Onchange event on the Select element. You can test the value of the element in the JS and change the image if the value equals the specific option.
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top