smida
2015-06-25 16:55
<!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 yourconfirm = confirm("是否打开");
if(yourconfirm==true){
var yourprompt = prompt("你的网址"," http://www.imooc.com/")
if (yourprompt != null){
window.open(yourprompt,"blank","width=400,height=500,menubar=no,toolbar=no")}
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
if(yourconfirm==true) 这里可以直接写 if(yourconfirm)
JavaScript入门篇
739817 学习 · 9566 问题
相似问题