Below code works perfectly with Firefox but not I.E. With I.E. When you click picture or buttons, no picture is shown. It seems "document.getElementById('photo').src=document.getElementById(mArray[preImg]).src" does not work in I.E. How can it be changed to make it worked with MS I.E.?
Thanks,
- Code: Select all
<html>
<head>
<title> A simple dynamic content change </title>
</head>
<body>
<table align=center width=1240 cellSpacing=0 cellPadding=1 border=0>
<tr><td> <H2> me Feeling <SPAN ID=emotion>Happy</SPAN></H2></td></tr>
<tr valign=top><td><form name="adenroll" action="" method="get">
<input key="prev" onclick="prev()" value="<Prev" type="button">
<IMG ID=photo SRC="../img/my.jpg" width="1024" height="686" onclick="next();">
<input key="next" onclick="next()" value="next>" type="button"></form></td></tr></table>
<H2><SPAN ID=e1 style="display:none">Sad</SPAN></H2>
<IMG ID=ph1 style="display:none" width="800" height="600" SRC="../img/my1.jpg">
<IMG ID=ph2 style="display:none" width="180" height="200" SRC="../media/1/1.jpg">
<IMG ID=ph3 style="display:none" width="180" SRC="../media/1/2.jpg">
<IMG ID=ph4 style="display:none" width="600" height="891" SRC="../media/125/4lena_000013.jpg">
<IMG ID=ph5 style="display:none" width="1024" SRC="../media/125/met-art_ry_239_6.jpg">
<IMG ID=ph6 style="display:none" height="1024" SRC="../media/125/met-art_ry_239_17.jpg">
<SCRIPT TYPE="text/javascript" >
var preImg = -1;
var mArray =['ph1','ph2','ph3','ph4','ph5','ph6'];
function next() {
if (preImg<5)
{
preImg++;
document.getElementById('photo').src=document.getElementById(mArray[preImg]).src;
document.getElementById('photo').width=document.getElementById(mArray[preImg]).width;
document.getElementById('photo').height=document.getElementById(mArray[preImg]).height;
emotion.innerHTML=mArray[preImg];
}
}
function prev() {
if (preImg>0)
{
preImg--;
document.getElementById('photo').src=document.getElementById(mArray[preImg]).src;
document.getElementById('photo').width=document.getElementById(mArray[preImg]).width;
document.getElementById('photo').height=document.getElementById(mArray[preImg]).height;
emotion.innerHTML=mArray[preImg];
}
}
</SCRIPT>
</body>
</html>

