<!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?st=confirm("你確定要打開窗口嗎?");
??????if(st==true);
??????{
??????????var?sp=prompt("默認(rèn)網(wǎng)站是","http://www.baidu.com");
??????????if(sp==null);
??????????{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}
??????}
??????????else
??????{
??????????alert("The?end");
??????}
??????else
??????{
??????alert("The?end");
??????}
??}
??</script>?
?</head>?
?<body>?
??<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>?
?</body>
</html>
2016-02-25
1、if(sp==null)修改為if(sp!=null);
2、url沒有賦值,可以更改為‘sp’。解釋:這里的url沒有任何意義,改為‘sp’后,就是運(yùn)行sp輸入的結(jié)果,輸入什么網(wǎng)址就會(huì)打開什么網(wǎng)址
2016-02-25
2016-02-25
URL 呢? OPEN誰就寫誰
2016-02-25
if(sp==null);這行刪掉
你默認(rèn)的網(wǎng)址是"
prompt();后面直接window.open();就行
你下面的兩個(gè)else重復(fù),刪掉一個(gè)
2016-02-25
url 沒賦值,從哪里跑出來的