本大慕王
2017-07-06 14:02
<!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 newtage=confirm("是否打开网该网址?");
if(newtage==true)
{var needtage=prompt("输入网址","http://www.imooc.com/");}
if(needtage!=null)
{window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
else
{alert(thanks)}
</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=gbk"/>
<script type="text/javascript">
function openWindow()
{
if(confirm("是否打开网该网址?"))
{
var needtage = prompt("输入网址", "http://www.imooc.com/");
if(needtage!=null)
window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no");
else
alert("thanks");
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
if(newtage==true)
{var needtage=prompt("输入网址","http://www.imooc.com/");}
if(needtage!=null)
{window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
else
{alert(thanks)}
没有if,if,else这种写法,
var newtage=confirm("是否打开网该网址?");
if(newtage==true)
{window.open("http://www.imooc.com/","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
else
{alert(“thanks”)}
JavaScript入门篇
739817 学习 · 9566 问题
相似问题