问答详情
源自:8-1 window对象

alert()需要点两次确定,求大神帮忙讲解一下

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>window对象</title>

<script type="text/javascript">

var a=0;

window.alert("欢迎来到慕课网"+a++);

function newweb(){

  window.open("http://www.imooc.com","_blank","width=600px,height=400px");  

}


</script>

</head>

<body>

<form>

<input type="button" value="点击我,打开新窗口" onclick="newweb()" />

</form>

</body>

</html>

alert()显示了两次,但是通过a的显示,能判断代码只执行了一次。

提问者:qq_X_181 2017-07-26 14:21

个回答

  • qq_X_181
    2017-07-26 15:37:21

    ok,已找到问题,慕课网的原因,正常运行的话   只有一次


  • 豆浆很好喝
    2017-07-26 15:15:39

    同样求解,难道是慕课网的BUG?