Closed Thread Icon

Topic awaiting preservation: Script not working in IE 4.0 Pages that link to <a href="https://ozoneasylum.com/backlink?for=8902" title="Pages that link to Topic awaiting preservation: Script not working in IE 4.0" rel="nofollow" >Topic awaiting preservation: Script not working in IE 4.0\

 
Author Thread
krets
Paranoid (IV) Mad Scientist

From: KC, KS
Insane since: Nov 2002

posted posted 10-13-2003 17:12

Hey guys, I've got a wonderful problem with a project I'm working on. I've been asked to make sure it works in all versions of IE from 4.0 up. I can ignore NN, Opera, etc because this project is running only on our systems so we know that only IE will be used. The problem is that I have no idea how to modify the script for IE 4.0 because I'm not familiar with how the DOM works.

Here's the script in full:

code:
if (!document.getElementById) return
var imgOriginSrc;
var imgTemp = new Array();
var imgarr = document.getElementsByTagName('img');
for (var i = 0; i < imgarr.length; i++) {
if (imgarr[i].getAttribute('hsrc')) {
imgTemp[i] = new Image();
imgTemp[i].src = imgarr[i].getAttribute('hsrc');
imgarr[i].onmouseover = function() {
imgOriginSrc = this.getAttribute('src');
this.setAttribute('src',this.getAttribute('hsrc'))
}
imgarr[i].onmouseout = function() {
this.setAttribute('src',imgOriginSrc)
}
}
}
}
onload=init;



Any help you can give me to get this working would be much appreciated.

EDIT: Oh, the images are all located inside a div called "topMenu." I think that might have something to do with it.

:::11oh1:::

[This message has been edited by krets (edited 10-13-2003).]

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

posted posted 10-13-2003 17:39

I don't think IE 4 have any support for the W3C DOM at all (edit: it was released one year before the Document Object Model Level 1 was released). You can forget getElementById and similar and use document.all instead.

But that's a rollover script right, and you could use another script instead. This one works in a similar way with a hsrc attribute, and will work in IE 4: http://www.youngpup.net/?request=/snippets/soopa-rollovers.xml



[This message has been edited by HZR (edited 10-13-2003).]

krets
Paranoid (IV) Mad Scientist

From: KC, KS
Insane since: Nov 2002

posted posted 10-13-2003 17:50

Yep, that one works much better.

Thanks HZR.

:::11oh1:::

« BackwardsOnwards »

Show Forum Drop Down Menu