:: Forum >> General/Off-topic >>

refreshing the jsp page dynamically

I want to refresh my jsp page at particuler time intervel.And the time intervel must be take from same page which is supplied by the user through some text box(which is placed in same jsp page)
Can any one help me out for this!

Thanks in advance
khader
khader Ahmed
Friday, December 30, 2005
<html>
<head>

var refreshinterval=180

// Shall the coundown be displayed inside your bar?
//Say "yes"or "no" below:
var displaycountdown="yes"
var starttime
var nowtime
var reloadseconds=0
var secondssinceloaded=0
var closeWindow = 0;
var div2print;

var locate = location.href

closeWindow = delineate(locate)
function starttime()
{
starttime=new Date()
starttime=starttime.getTime()
countdown()
}

function countdown()
{
nowtime= new Date()
nowtime=nowtime.getTime()
secondssinceloaded=(nowtime-starttime)/1000
reloadseconds=Math.round(refreshinterval-secondssinceloaded)

if (refreshinterval>=secondssinceloaded)
{
var timer=setTimeout("countdown()",1000)
if (displaycountdown=="yes")
{
window.status="Page refreshing in "+reloadseconds+ " seconds"
//window.status="Page refreshing in "+closeWindow+ " seconds"

closeWindow++;
}
}

else
{
clearTimeout(timer)
var newPage = "yourpage.jsp?id=" +closeWindow+"&id1=2"
window.location = newPage
}
}
</head>
<body onLoad="starttime()>

</body>
</html>
M Hoque
Monday, January 30, 2006
function delineate(str )
{
theleft = str.indexOf("=") + 1;
theright = str.lastIndexOf("&");
var refValue = str.substring(theleft, theright);
return refValue;
}


//Add this function also to the script
M Hoque
Monday, January 30, 2006



This topic is archived.

Back to support forum

Forum search