View Single Post
  #5 (permalink)  
Old 09-23-07, 07:41 PM
patter patter is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
I took the parts of the code that have to do with this and created an html file. It can be reached http://64.22.69.19/~ptosc/rollover/change_image.htmlIf you view that in IE, it will work fine. If you view it in Firefox, it will work once if you rollover the Natural box then it no longer works until the page is reloaded. The complete code is below. The variables are not global. They were just not declared.

HTML Code:
<html>
<head>
<title></title>
</head>
<body>
<table width="266" height="266" border="0" cellpadding="0"
cellspacing="1" bgcolor="#AD88B5">
<tr>
<td align="center" valign="middle">
<table width="264" height="264" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td align="center" valign="middle" bgcolor="#FFFFFF">
 <span id="theimage"><img src="images/testimgs/103-1.gif" border="0" hspace="0" vspace="0"></span></td>
</tr>
</table>
</td>
</tr>
</table>

 

<table width="266" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>*</td>
</tr>

 
<tr>
<td align="center"><script type="text/javascript">
var pimage=new Image();
pimage.src="images/testimgs/103-1.gif";

var im1="images/testimgs/103-1.gif";
var im2="images/testimgs/103-3.gif";

var im1f=new Image();
var im2f=new Image();

im1="images/testimgs/103-2.gif";
im1f.src="images/testimgs/103-1.gif";
im2="images/testimgs/103-4.gif";
im2f.src="images/testimgs/103-3.gif";

function SetImage(newimage)
{
var imspan=document.getElementById("theimage");
var html='<img id="mainimage">';
theimage.innerHTML=html;
mainimage.src=newimage.src;
}
var im=new Image();
im.src="";
//SetImage(im);
</script> <script type="text/javascript">
if (im1!="images/") document.write('<img src="'+im1+'" onmouseover="SetImage(im1f);" width="70">');
if (im2!="images/") document.write('<img src="'+im2+'" onmouseover="SetImage(im2f);" width="70">');
 
</script></td>
</tr>
</table>
</body>
</html>
Reply With Quote