代碼如何修改,才能使加載到100%時打開一個新窗口,且只打開一個新窗口,我這代碼執(zhí)行后會打開無數(shù)個窗口,如何修改代碼?<!DOCTYPE?html>
<html>
<head>
<meta?charset="utf-8"?/>
<title>進度條</title>
</head>
<head>
<style?type="text/css">
#border_style?{
????width:200px;
????border:1px?solid?#000;
????background:#CCC;
????color:#000;
}
#progress?{
????display:block;
????width:0px;
????background:#CCCCFF;
}
#text?{
????margin-left:30px
}
*?{
????margin:0;
????padding:0;
}
</style>
<script?language="javascript">
function?progressL(n){
var?p=document.getElementById('progress');
var?text?=?document.getElementById("text");
p.childNodes[0].nodeValue=n+"%";
p.style.width=(n*2)+"px";
n+=1;
if(n>25){
????text.innerHTML="正在加載....";
????}
if(n>60){
????text.innerHTML="加載即將完成....";
????}
if(n>85){
????text.innerHTML="即將打開新窗口....";?
????}
if(n>100){
????window.open('http://www.baidu.com','width=600,height=400px,top=100px,left=0px','_blank')
????n=100;
????}
setTimeout('progressL('+n+')',80);
}
</script>
</head>
<body>
<p?id="border_style"><span?id="progress">0%</span></p>
<br/>
<div?id="text"></div>
<script?language="javascript">
progressL(0);
</script>
</body>
</html>
如何在加載到100%時打開新窗口?
阿爾濱必勝
2015-08-26 11:31:06