This is as far as I got. I don't understand the errors in JSHint.com, unfortunately, so I can't go further.
Upon body onLoad, the function is supposed to run. It gets a 126-byte file from our server and checks it for height size. If it is larger than 0 bytes, then the first option is supposed to run, which means to put "On" in the input field. Otherwise, if the size is less than 0, it puts "Off" in the input field. Currently, when I double-click on the script file to open it, nothing shows in the text input field. (Putting the code right after the onLoad line, or putting the code just before the </body> tag doesn't affect it.)
HTML Code:
<title>
Testing Internet Connection On/Off Status
</title>
<script type="text/javascript">
function testConnection() {
var checkExistenceOfImg = new Image();
checkExistenceOfImg.src =
"http://aedownloads.com/misc/testConnectionInApp.png";
if(checkExistenceOfImg.height > 0) {
function showOn(form) {
var form = document.getElementById('formConnection');
var a = form.elements.status.value;
form.elements.status.value = "On";
}
}
else {
var form = document.getElementById('formConnection');
var a = form.elements.status.value;
form.elements.status.value = "Off";
}
}
</script>
</head>
<body onLoad="testConnection()">
<div id="content">
<div class="pageitem"><div class="textbox">
<p class="term">
Testing Internet Connection
</p>
</div></div>
<div class="pageitem"><div class="textbox">
<form id="formConnection">
<input id="connectionStatus" class="display2" size="1" type="text" name="status" value="">
</form>
</div> </div>
</div> <!-- content -->
<!-- testConnectionInApp.png is a 126bytes 10x10px PNG image. -->
</body>
Bookmarks