無龑
2019-11-04 13:14
<!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 message=confirm("是否打开新网页?");
if(message==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500,top=100,left=0,toolbar=no,menubar=no');
}
else
{
return null;
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
function openWindow(){ var Message = confirm("Are you sure want to open a site?"); if(Message == true){ var URL = prompt("Enter an url to open","http://www.imooc.com/") while (URL === ""){ alert("Please enter an url"); var URL = prompt("Enter an url to open","http://www.imooc.com/"); } if (URL != null) { window.open(URL,"_blank","width=400,height=500,menubar=no,toolbar=no"); } else { return; } } else { return; } }
少满足一个要求
JavaScript入门篇
739817 学习 · 9566 问题
相似问题