Billybonga
IS-IT--Management
What I'm trying to do with the code is rather than having text saying "You are currently on-line" / "You are currently off-line", I want to show a small on/off image
Here is what I've come up with - only thing is : It doesn't work.
<html>
<head>
<script type="text/javascript">
<!--
var tempImage;
function checkOnlineStatus() {
var tempImage = new Image();
tempImage.onload = returnOnlineStatus;
tempImage.onerror = returnOfflineStatus;
tempImage.src = ' // this must point to the url of a valid image
}
function returnOnlineStatus() {
var onImage = new Image();
onImage.src = 'on.gif';
document.getElementById('onlineStatus').firstChild.nodeValue = onImage;
}
function returnOfflineStatus() {
var offImage = new Image();
offImage.src = 'off.gif';
document.getElementById('onlineStatus').firstChild.nodeValue = offImage;
}
//-->
</script>
</head>
<body onload="checkOnlineStatus();">
<div><img src="test.gif" id="onlineStatus" width="19" height="18"></div>
</body>
</html>
Thanks for any help with this
Here is what I've come up with - only thing is : It doesn't work.
<html>
<head>
<script type="text/javascript">
<!--
var tempImage;
function checkOnlineStatus() {
var tempImage = new Image();
tempImage.onload = returnOnlineStatus;
tempImage.onerror = returnOfflineStatus;
tempImage.src = ' // this must point to the url of a valid image
}
function returnOnlineStatus() {
var onImage = new Image();
onImage.src = 'on.gif';
document.getElementById('onlineStatus').firstChild.nodeValue = onImage;
}
function returnOfflineStatus() {
var offImage = new Image();
offImage.src = 'off.gif';
document.getElementById('onlineStatus').firstChild.nodeValue = offImage;
}
//-->
</script>
</head>
<body onload="checkOnlineStatus();">
<div><img src="test.gif" id="onlineStatus" width="19" height="18"></div>
</body>
</html>
Thanks for any help with this