help me about this script .i want refresh page on 12.30 at local time its. auto refresh the page on 12.30, and local set time,. can any one help me
help me about this script .i want refresh page on 12.30 at local time its. auto refresh the page on 12.30, and local set time,. can any one help me
Here is an example which will refresh the page at a give time.
1. Save the code.Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Untitled Document</title> <style type="text/css"> </style> <script type="text/javascript"> function refreshPage(tme){ if(new Date().getMinutes() < 10) var time = new Date().getHours() + ":0" + new Date().getMinutes(); else var time = new Date().getHours() + ":" + new Date().getMinutes(); if (time === tme) { clearInterval(glblInterval); if(window.location.href.indexOf('?rel=1') == -1){ window.location.href = window.location.href + "?rel=1"; } }else { if(window.location.href.indexOf('?rel=1') != -1){ clearInterval(glblInterval); } return; } } var glblInterval = setInterval(function(){ refreshPage('12:30'); //SPECIFY THE TIME IN 24HRS FORMAT HERE AT WHICH THE PAGE NEEDS TO BE REFRESHED. }, 1000); </script> </head> <body> <h1>Test</h1> <input type="button" value="change" onclick="document.body.getElementsByTagName('h1')[0].innerHTML = 'Changed';"/> </body> </html>
2. Specify the time at which you want to refresh the page in the following code segment - change the highlighted area (hrs:mins)
3. Now inorder to identify the page refresh, you can click on the 'change' button and wait until the mentioned time. At the correct time the page will be refreshed and the timer will be disabled.Code:var glblInterval = setInterval(function(){ refreshPage('12:30'); //SPECIFY THE TIME IN 24HRS FORMAT HERE AT WHICH THE PAGE NEEDS TO BE REFRESHED. }, 1000);
Hope this helps.
sir i want there is no button on page i just upload 2 movies on page and after the selected time which i set like set alarm page can refresh and which 2nd movie i upload play...refresh auto.
its like count down time....means after 30 mint its play and after it will be 12.30 and when 12.30 page can refresh
The above code is meant for a demo, so when the page loads I just want to give an impression that the page reloads at the mentioned time thats all. You can use the JavaScript code without using the button I've mentioned in my posting. In other words the functionality of the button in my demo page doesn't have anything do with the JavaScript in the page.
You can use only the JavaScript code snippet for your requirement nothing else.
Hope this helps.
mir4kir (09-28-2008)
i am sorry sir i am new in java i don't understand this script can u clear me..how can i.i am really thanks full to you........u understand na what i want. i just one time set the page refresh option in page and upload to web,and automatic refresh on selected time.
1. Insert the following code in the page you want to refresh automatically.
2. Change the highlighted part in the above code with the time information at which the page needs to be refreshed. Currently I've set it as 12:30. You can change it if you need to specify another time.Code:<script type="text/javascript"> function refreshPage(tme){ if(new Date().getMinutes() < 10) var time = new Date().getHours() + ":0" + new Date().getMinutes(); else var time = new Date().getHours() + ":" + new Date().getMinutes(); if (time === tme) { clearInterval(glblInterval); if(window.location.href.indexOf('?rel=1') == -1){ window.location.href = window.location.href + "?rel=1"; } }else { if(window.location.href.indexOf('?rel=1') != -1){ clearInterval(glblInterval); } return; } } var glblInterval = setInterval(function(){ refreshPage('12:30'); //SPECIFY THE TIME IN 24HRS FORMAT HERE AT WHICH THE PAGE NEEDS TO BE REFRESHED. }, 1000); </script>
Thats all you need to do
mir4kir (09-28-2008)
thanks you soo much..dear
sir i want to add one thing i want to page refresh 2 time one 12 .30 and one 12.32
how can i?
Last edited by mir4kir; 09-26-2008 at 01:59 PM.
Bookmarks