Meredith_Grey
2016-03-29 20:34
<!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 taylor=confirm("确定打开窗口?");
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
if(taylor==true){
var swift=prompt("请输入网址:","http://www.imooc.com");
if(swift!=null){
window.open(swift,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}else{
alert("see you next time!");
}
}else{
alert("ahaha");
}
}
//打开的窗口要求,宽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=utf-8"/>
<script type="text/javascript">
function openWinow(){
var mymessage = confirm("确认打开窗口");
if(mymessage == true){
var myurl = prompt("确认网址","http://www.imooc.com");
window.open(myurl,'_blank','width=400,height=500,menubar = no,toolbar = no');
}
else{
}
}
openWinow();
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
同上............
30秒
var swift=prompt("请输入网址:","http://www.imooc.com");
这一行参数间的逗号是中文字符,找了好久才发现。。。。
JavaScript入门篇
742055 学习 · 9869 问题
相似问题