慕神702323
2019-03-29 11:08
<!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 m=confirm("是否打开?");
if(m==true)
{
var s =prompt("输入网址:");
window.open('s','_blank','width=400,height=500,menubar=no,toolbar=no, status=yes ,scrollbars=yes')
}
else
return 0;
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
跟大小写没关系吧 直接window.open("http://www.imooc.com","...");这样就行了吧 感觉用confirm方便些
W大写
function window()写错了,Window而不是window,
window.open('s','_blank','width=400,height=500,menubar=no,toolbar=no, status=yes ,scrollbars=yes')
s不用打引号,打了引号表示你打开了一个网址是s的网站,没有这个网站。你直接打一个s,引用的就是你上面s参数保存的网址
JavaScript入门篇
741617 学习 · 9869 问题
相似问题