pomelo9240
2016-04-08 15:14
大神可以帮忙看看我的代码哪里错了吗,我点按钮没有反应..
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>window对象</title>
<script type="text/javascript">
function push() {
alert("欢迎来到慕课网");
window.open("www.baidu.com","_blank","width=600px,height=400px");
}
</script>
</head>
<body>
<form>
<input type="button" value="点击我,打开新窗口" onclick="push()" />
</form>
</body>
</html>
代码有错! alert语句后面的分号应该是英文状态下的。
设置宽高只要写数字,不需要单位px
alert("欢迎来到慕课网");后面的分号要英文状态下的
alert语句末尾的分号应该是英文状态下的分号。
代码没问题,是慕课网编辑器的问题
JavaScript进阶篇
469062 学习 · 22582 问题
相似问题