为理想我拼了
2015-03-26 16:53
今天刚学到这,做习题才发现对函数的记忆还不够,还好后来做出来了。
用了嵌套if语句
<!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 myWin=confirm('点击确定打开慕课网');
// 新窗口打开时弹出确认框,是否打开
if(myWin==true){
value1=prompt('你确认要打开慕课网吗?','http://www.imooc.com');
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
if(value1!=null){
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');}
}
else{}
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>JavaScript入门篇
741604 学习 · 9869 问题
相似问题