如何使用基于时间的javascript显示jsp页面的弹出窗口?

时间:2012-11-08 11:19:40

标签: javascript html jsp

我想创建一个JSP页面。我想在其中每隔10秒显示一个弹出窗口。此外,我想输入一个值来检查弹出窗口本身的身份验证。怎么做?

<tr> <td> I VALUE : <input type="text" name="t1" /></td> </tr> <tr> <td> F VALUE : <input type="text" name="t2" /> </tr> <tr><td><input type="submit" name="b1" value="CHECK...!" />

这是我的jscript

    function validateForm() 
{ long delay = 10*1000; // delay in ms : 10 * 1000 ms = 10 sec. 

LoopTask task = new LoopTask(); 
Timer timer = new Timer("TaskName"); 
public void start() 
{ timer.cancel(); 
timer = new Timer("TaskName"); 
public void run() { popitup();
 } 
function popitup(url) 
{ newwindow=window.open('localhost:8080/Authentication/…); 
if (window.focus) 
{newwindow.focus();
} return false; 
} } } </script> 

1 个答案:

答案 0 :(得分:1)

请尝试在新警告窗口

// newwindow = window.open(URL, '名称', '身高= 200,宽度= 150');

<!DOCTYPE html>
<html>
<head>
<script>
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
if((parseInt(s)%10)==0)
alert("hello");// here alert change as  popup     
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout(function(){startTime()},500);
}

function checkTime(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
</script>
</head>

<body onload="startTime()">
<div id="txt"></div>
</body>
</html>