Thanks for both the replies Weirdan & pickle. This is the code i am using that works
Code: Select all
document.getElementById('Link').addEventListener('mouseover', function(e) { displayHidden('hidden'); }, false);
document.getElementById('Link').addEventListener('mouseout', function(e) { hideDisplay('hidden');}, false);
I've only tested it using Firefox at the moment. From examples i've seen Internet Explorer requires a different method when adding event listeners.
Edit
I've added the following to the script to add event listeners for internet explorer. This is the complete function i use to add event listeners for both IE and FF. The IE ones doesn't seem to work but i don't receive any errors from the browser to indicate a problem.
Code: Select all
function init()
{
var linkId = document.getElementById('Link');
if (typeof linkId.addEventListener != "undefined") {
document.getElementById('Link').addEventListener('mouseover', function(e){ displayHidden('hidden');}, false);
document.getElementById('Link').addEventListener('mouseout', function(e){ hideDisplay('hidden');}, false);
}
else if (typeof linkId.attachEvent != "undefined") {
// add 'on' the events.
linkId.attachEvent('onmouseover', function(e){ displayHidden('hidden');});
linkId.attachEvent('onmouseout', function(e){ hideDisplay('hidden');});
}
}
Edit
Adding 'on' to the events when attaching them solves the problem.