Forum Moderators: open
I use a JS to have a MouseOver in an Image Map. (When moving the mouse over a certain area ('area') a text should be displayed in a certain area ('descr'). To achieve that I use a JS-function
*****************************************************
ns = (document.layers)? true:false
ie = (document.all)? true:false
function layerWrite(text) {
if (ns) {
var lyr = document.layers['descr'].document
lyr.open()
lyr.write(text)
lyr.close()
}
else if (ie) document.all['descr'].innerHTML = text
}
********************************************************
All works fine with IE5, but from Version IE6 and Mozilla and Netscape nothing works!
I assume there is something wrong with the way I use the document-object .....
May someone help me or give a hint. I have tried different things already, but didn't find an apporpriate exampl yet.
Sorry - if my problem is trivial, but I got stuck and really need that :-(
Thanks
k soltau
To cover ALL browsers ver 5+ (arguably everything, unless you get good money to support Netscape 4 / IE 4), your function could simply read:
[pre]
function layerWrite(text)
{
document.getElementById('descr').innerHTML = text
}
[/pre] Your browser sniffers should be:
ns4 = (document.layers)?true:false
moz = (document.getElementById &&!document.all)?true:false
IE5 = (document.getElementById && document.all)?true:false // + upwards
IE4 = (document.all &&!document.getElementById))?true:false
You don't need them here (apart from to prevent v4s from being used)