12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
-
-
-
- var seconds = 1;
- var divid = "shoutcastdiv";
- var url = "test.txt";
-
- ////////////////////////////////
- //
- // Refreshing the DIV
- //
- ////////////////////////////////
-
- function refreshdiv(){
-
- // The XMLHttpRequest object
-
- var xmlHttp;
- try{
- xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
- }
- catch (e){
- try{
- xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
- }
- catch (e){
- try{
- xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e){
- alert("Your browser does not support AJAX.");
- return false;
- }
- }
- }
-
- // Timestamp for preventing IE caching the GET request
-
- fetch_unix_timestamp = function()
- {
- return parseInt(new Date().getTime().toString().substring(0, 10))
- }
-
- var timestamp = fetch_unix_timestamp();
- var nocacheurl = url+"?t="+timestamp;
-
- // The code...
-
- xmlHttp.onreadystatechange=function(){
- if(xmlHttp.readyState==4){
- document.getElementById(divid).innerHTML=xmlHttp.responseText;
- setTimeout('refreshdiv()',seconds*1000);
- }
- }
- xmlHttp.open("GET",url,true);
- xmlHttp.send(null);
- }
-
- // Start the refreshing process
-
- window.onload = function startrefresh(){
- setTimeout('refreshdiv()',seconds*1000);
- }
|