3

我想创建一个 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...!" />

这是我的脚本

    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> 
4

1 回答 1

1

请尝试在新窗口中收到警报

//newwindow=window.open(url,'name','height=200,width=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>
于 2012-11-08T11:31:07.483 回答