Forum Moderators: open
If you need me to clarify what it's doing let me know...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Online/Offline JavaScript</title>
<SCRIPT LANGUAGE="JavaScript">
//identify the element based on browser type
isNS4 = (document.layers)? true : false;
isIE4 = (document.all &&!document.getElementById)? true : false;
isIE5 = (document.all && document.getElementById)? true : false;
isNS6 = (!document.all && document.getElementById)? true : false;
function switchDiv(strDivName, bolVisible){
if (isNS4) {
objElement = document.layers[strDivName];
} else if (isIE4) {
objElement = document.all[strDivName];
} else if (isIE5 ¦¦ isNS6) {
objElement = document.getElementById(strDivName);
}
if(isNS4){
if(!bolVisible){
objElement.visibility ="hidden";
}else{
objElement.visibility ="visible";
}
}else{
if(!bolVisible) {
objElement.style.visibility = "hidden";
}else{
objElement.style.visibility = "visible";
}}}
function imageError(imgURL) {
switchDiv('Print_btn', true);
switchDiv('Email_btn', false);
}
</SCRIPT>
</head>
<body>
<img name="logo" src="http://google.com/images/logo.gif" border="0" height="0" width="0" onLoad="switchDiv('Print_btn', false);" onError="imageError(this)" onAbort="imageError(this)">
<button id="Print_btn">Print</button>
<button id="Email_btn">Email</button>
</body>
</html>
On line 18 the '¦¦' is supposed to be two "pipe" characters - not the character that they've been replaced with.
If you can't figure the change out - you can split this statement into two:
REPLACE:
} else if (isIE5 ¦¦ isNS6) {
objElement = document.getElementById(strDivName);
}
} else if (isIE5) {
objElement = document.getElementById(strDivName);
} else if (isNS6) {
objElement = document.getElementById(strDivName);
}