Otone
2018-07-23 18:12
<!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 winopen = confirm("是否打开窗口?");
if(winopen == true)
{
var winsubmit = prompt("请输入打开的网址:","http://www.imooc.com/");
if(winsubmit!=null)
{
window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no')
}
else
{
window.open('','_blank','width=400,height=500,menubar=no,toolbar=no')
}
}
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>代码如上,怎么样可以让他打开的网址是我输入的网址,还有我这样写有问题吗,求各位大佬解答
window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no')中划线部分改成winsubmit
输入winsubmit时不要带引号
JavaScript入门篇
741590 学习 · 9869 问题
相似问题