qq_Me是俊老头_03323788
2016-05-10 23:01
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function openWindow(){
var click = confirm("确认框");
if(click == true){
var url = prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
if(url !=null){
window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
}else{
alert("byebye!");
}
}else{
alert("byebye!");
}
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
加了最后一个大括号后是对的,那个慕课网上面可能有点问题 你不要在慕课网里试效果,你可以复制你的代码在一个html文档里 然后编译就可以出来效果了 你的代码没有错
少了一个'}'
对头,少了一个'}'
楼上说的对
function openWindow(){ 少了最后一个“}”大括号
JavaScript入门篇
742056 学习 · 9869 问题
相似问题