[thelist] [Javascript] unobtrusive scripting, rollovers and IE7, oh my!
Paul Bennett
Paul.Bennett at wcc.govt.nz
Tue Jul 18 19:31:18 CDT 2006
Hi all,
I'm working with unobtrusive scripting for the first time in order to get a lot of extraneous cruft out of my markup.
I have a test page here:
http://tinyurl.com/hoams
I'm using Scott Andrew's attachEvent code (http://www.scottandrew.com/weblog/articles/cbs-events), which is working fine. It's my home-grown rollover code that is throwing the error.
Opera and FF both process the rollover code without error, but IE6 and 7 give me this error:
'this.src is null or not an object'
I've played with things as much as I can, but it seems I need a bigger brain to help here.
The function code is:
-----------------------
function imageRoll() {
if(this.src.indexOf('-over.jpg') != -1){
this.src = this.src.substr(0, this.src.indexOf('-over.jpg'));
this.src = this.src+'.jpg';
}
else {
this.src = this.src.substr(0, this.src.indexOf('.jpg'));
this.src = this.src+'-over.jpg';
}
}
-----------------------
Any help is greatly appreciated,
Paul
More information about the thelist
mailing list