need a way to refresh a div every 20 seconds :S it is possible ive seen the script where abouts before but cannot re find it+rep for all help
ive found a way round using iframes at last![]()

need a way to refresh a div every 20 seconds :S it is possible ive seen the script where abouts before but cannot re find it+rep for all help
ive found a way round using iframes at last![]()
I have typed getting some thing like this but when i tryed it did not work and i have ask on many forum so i would like some thing like this to so i do hope some one can help Eccentric and me to![]()
Lol i cant remember wher i saw it :S
Make a function which loads the html into the DIV.
Then just use setInterval() to make it run the function every 20 seconds.
right simon,
i have this so far,
what do i do nowCode:function LoadPage(page,usediv) { // Set up request varible try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { alert("Error: Could not load page.");} //Show page is loading document.getElementById(usediv).innerHTML = 'Loading Page...'; //scroll to top scroll(0,0); //send data xmlhttp.onreadystatechange = function(){ //Check page is completed and there were no problems. if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) { //Write data returned to page document.getElementById(usediv).innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", page); xmlhttp.send(null); //Stop any link loading normaly }![]()
put it in your source web page
function LoadPage(page,usediv) {
// Set up request varible
try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { alert("Error: Could not load page.");}
//Show page is loading
document.getElementById(usediv).innerHTML = 'Loading Page...';
//scroll to top
scroll(0,0);
//send data
xmlhttp.onreadystatechange = function(){
//Check page is completed and there were no problems.
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
//Write data returned to page
document.getElementById(usediv).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", page);
xmlhttp.send(null);
//Stop any link loading normaly
}
setInterval('LoadPage()', 2000);
i know have that but i believe it isnt working![]()
Change:
setInterval('LoadPage()', 2000);
To:
setInterval('LoadPage("thepageyouwanttoload.php", "div you want the page to show in")', 2000);
Thanks si, ill try that now.
Edit;
Simon you are a star my friend. +rep! need to spread to be honest :|
Last edited by Eccentric; 15-09-2007 at 04:29 PM.
UPDATE:
i know see double of everything its to do with that piece of ajax :|
Want to hide these adverts? Register an account for free!