K
Kush
Guest
Hi, I'm having trouble with the following JS in Safari:
Not being a big Javascript user, I can't understand why this doesn't work in Safari? You can see the alerts I've put in... well none of them show up, so I've identified where my problems begin at least!
I've tested it on IE, Firefox and Opera for PC and it works no problem.
Any ideas? :dive:
Code:
function showhide(layer_ref,page,image_id,showhide) {
if (page=='comments') {
document.all.rightiframe.src='commentsframe.php?image_id=' + image_id;
}
if (page=='shoutbox') {
document.all.rightiframe.src='shoutboxframe.php';
}
if (showhide == 'yes') {
if (state == 'visible') {
state = 'hidden';
}
else {
state = 'visible';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
alert("1");
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
alert("2");
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
alert("3");
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}
}
Not being a big Javascript user, I can't understand why this doesn't work in Safari? You can see the alerts I've put in... well none of them show up, so I've identified where my problems begin at least!
I've tested it on IE, Firefox and Opera for PC and it works no problem.
Any ideas? :dive: