DM_耿
2016-02-17 23:37
<!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 wop=confirm("你确定要打开吗?");
if(wop==true){
var www = prompt("您确定要打开慕课网吗?"," http://www.imooc.com/") ;
if(www!=null){
window.open(www,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
}else{
alert("退出成功!");
}else{
alert("退出成功!");
}
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
错误原因是少了没有大括号
<!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 wop=confirm("你确定要打开吗?");
if(wop==true){
var www = prompt("您确定要打开慕课网吗?"," http://www.imooc.com/") ;
if(www!=null){
window.open(www,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
}else{
alert("退出成功!");}
}else{
alert("退出成功!");
}
}
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
JavaScript入门篇
741269 学习 · 9867 问题
相似问题