event handling in netscape4

admin

Administrator
Staff member
i seem to be having some probs working out how to handle evnts in netscape4.
viz:

function handler(e){
swapImg('...img_name...');
}


function addhandler(o){
o.onmouseover = handler;
o.onmouseout = handler;
}

function init(){
if(document.all || document.getElementById){
var img = document.images;
img['outlook'].onmouseover = function() {swapImg('outlook');}
img['outlook'].onmouseout = function() {imgRestore('outlook');}
img['befriending'].onmouseover = function() {swapImg('befriending');}
img['befriending'].onmouseout = function() {imgRestore('befriending');}
img['employment'].onmouseover = function() {swapImg('employment');}
img['employment'].onmouseout = function() {imgRestore('employment');}
img['run'].onmouseover = function() {swapImg('run');}
img['run'].onmouseout = function() {imgRestore('run');}
}
else if(document.layers){
addhandler(document.images['...img_name...']);
}
}

window.onload = init;

the code works fine for ie5+ and nn6, however, when i try and use it in nn4, i get a message telling me that object o has no properties.
i really cant figure this out.
or understand what the error message means. any advice?
i followed the flanagan procedure of adding handlers to the events in his event handler script.
no joy.
do i need to use captureEvents(event.MOUSEOVER etc) to initially capture the event? tried this but obviously i am told onload that there is no event associated with the capture.
 
Back
Top