qq_浮雲遊子_03977413
2017-02-03 19:24
2.7的练习不会 555
window是关键字
你的var window=confirm("是否打开新窗口");这句变量名改成别的
<!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 mymessage=confirm("确定要打开吗?");
if (mymessage==true){
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
var mind=prompt("您是要打开下面的网址吗?","http://www.imooc.com/");
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
if (mind=="http://www.imooc.com/"){
window.open("http://www.imooc.com/","_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
}
</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 mind=prompt("确定打开吗?","http://www.imooc.com");
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
if (mind=="http://www.imooc.com"){
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
window.open("http://www.imooc.com","_blank","width=400,height=500,menubar=no,toolbar=no");
}};
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>JavaScript入门篇
741594 学习 · 9869 问题
相似问题