Can anybody explain why my variable imonline is still 1 even though my
onError function has fired , value = 0 when printed by Javascript
document.write at end. I thought that
VAR imonline = 1
should have given me a global variable
TIA
<HTML>
<SCRIPT LANGUAGE="JavaS cript">
var imonline = 1;
function imageError(theI mage) {imonline=0; document.JWonli ne.src =
"2_yellow.jpg"; }
</script>
</HEAD>
<BODY BGCOLOR="#b5ccb 8">
<H2><CENTER>I s the green button loaded 2</CENTER></H2>
<!-- 2_greenx.jpg does not exist for this test -->
<img name="JWonline" src="2_greenx.j pg" align=left border=0
onError="imageE rror(this)"
onAbort="imageE rror(this)">
<p>Yellow button indicates offline<br>
Green button indicates online
<!-- since yellow button is on, so imonline should be 0 -->
<SCRIPT LANGUAGE="JavaS cript">
document.write( "<BR>online=",i monline);
</script>
</BODY>
</HTML>
John Wood
onError function has fired , value = 0 when printed by Javascript
document.write at end. I thought that
VAR imonline = 1
should have given me a global variable
TIA
<HTML>
<SCRIPT LANGUAGE="JavaS cript">
var imonline = 1;
function imageError(theI mage) {imonline=0; document.JWonli ne.src =
"2_yellow.jpg"; }
</script>
</HEAD>
<BODY BGCOLOR="#b5ccb 8">
<H2><CENTER>I s the green button loaded 2</CENTER></H2>
<!-- 2_greenx.jpg does not exist for this test -->
<img name="JWonline" src="2_greenx.j pg" align=left border=0
onError="imageE rror(this)"
onAbort="imageE rror(this)">
<p>Yellow button indicates offline<br>
Green button indicates online
<!-- since yellow button is on, so imonline should be 0 -->
<SCRIPT LANGUAGE="JavaS cript">
document.write( "<BR>online=",i monline);
</script>
</BODY>
</HTML>
John Wood
Comment