Please help... this is doing my head in! I have some gifs within a page that when clicked on switch to an animated version. The script below works great in FF or safari... but not in ie. Any tips here would save me hitting the bottle!
the img tag is:
[HTML]<img src="/graphics/prmoff.gif" width="250" height="188" id="prm" onClick="animat eMe('prm');" alt="Click to start/stop animation">
[/HTML]
the code is:
[CODE=javascript]function animateMe(id){
var onsrc = /graphics/" + id + "on.gif";
var offsrc = /graphics/" + id + "off.gif";
var newSrc = document.getEle mentById(id).sr c;
alert(newSrc);
var pos=newSrc.inde xOf('on.gif');
if(pos=="-1"){
document.getEle mentById(id).sr c=onsrc;
}
else {
document.getEle mentById(id).sr c=offsrc;
}
}[/CODE]
the img tag is:
[HTML]<img src="/graphics/prmoff.gif" width="250" height="188" id="prm" onClick="animat eMe('prm');" alt="Click to start/stop animation">
[/HTML]
the code is:
[CODE=javascript]function animateMe(id){
var onsrc = /graphics/" + id + "on.gif";
var offsrc = /graphics/" + id + "off.gif";
var newSrc = document.getEle mentById(id).sr c;
alert(newSrc);
var pos=newSrc.inde xOf('on.gif');
if(pos=="-1"){
document.getEle mentById(id).sr c=onsrc;
}
else {
document.getEle mentById(id).sr c=offsrc;
}
}[/CODE]
Comment