为什么点击了alert之后,页面上出现了两个input?????

来源:8-1 window对象

姣姣酱酱酱

2018-07-29 19:03

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>window对象</title>
<script type="text/javascript">
alert("欢迎来到慕课网");
function openWindow(){
    window.open('http://www.baidu.com',"_blank",'width = 600','height = 400')
}
</script>
</head>
<body>
<form>
<input type="button" value="点击我,打开新窗口"  onclick="openWindow()"/>
</form>
</body>
</html>



写回答 关注

2回答

  • 玄众妙
    2019-05-24 11:27:20

    window.open('http://www.baidu.com',"_blank",'width = 600','height = 400')后面加个分号试试

  • tobtoo
    2018-07-30 16:08:05

    可能是慕课的编辑器有问题,我把你代码复制到html里面运行没有弹出两次input

JavaScript进阶篇

本课程从如何插入JS代码开始,带您进入网页动态交互世界

468672 学习 · 21895 问题

查看课程

相似问题