為什么執(zhí)行到num=0時,沒有打開新網(wǎng)頁
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var num=5;
function five(){
?if(num==0){
? window.open('http://idcbgp.cn');
?}
?else{
document.getElementById("button").value=num;
? ? num=num-1;
? ? ?setTimeout("five()",1000);
}}
</script>
</head>
<body>
<input id="button" type="button" onclick="five()" value="倒數(shù)五秒進入幕客網(wǎng)" style="color:#C00;width:1000px;background:#0F0">
</body>
</html>
2017-12-27
我這邊是瀏覽器阻止了網(wǎng)頁打開新窗口,在提示的地方選擇始終允許就行了