0

Hi,

I use a code to display the counter result and to refresh that value I actually refresh all the page, I'd like to refresh the script only without refreshing the full page but I don't know how to modify the code to make it work.
Here's the actual code using the page refresh:
<body bgcolor="#566079" align="center">
<font face="Verdana" size="1" color="#C0C0C0">
<script language="JavaScript" src="../cgi-bin/online/online.cgi?output=javascript"> </script> visitors online
</font>
</body>


And here's the code I'd like to see:
<head>
<script language="JavaScript">
function vonline()
TO BE REPLACED BY ?
</script>

</head>
<body onLoad="javascript:setInterval('vonline()',5000);" bgcolor="#566079" align="center">
<font face="Verdana" size="1" color="#C0C0C0">
<script language="JavaScript" src="../cgi-bin/online/online.cgi?output=javascript"> </script> visitors online TO BE REPLACED BY ?
</font>
</body>

Thank you for all help...
G.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by hitdrumhard
0

First, you want to give your script tag an id: <script id="visitors" language="JavaScript" src="../cgi-bin/online/online.cgi?output=javascript"> </script> visitors online then, your vonline() method should look something like this:

function vonline()
{
    var scriptTag = document.getElementById('visitors');
    scriptTag.src = "../cgi-bin/online/online.cgi?output=javascript";
}

That should refresh the javascript without reloading the page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.