<!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?m=confirm("是否打開?");
????if(m==true)
????{
????????var?s?=prompt("輸入網址:");
????????window.open('s','_blank','width=400,height=500,menubar=no,toolbar=no,?status=yes?,scrollbars=yes')
????}
????else
????return?0;
????
????
????//?新窗口打開時彈出確認框,是否打開
????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????
????}
??</script>?
?</head>?
?<body>?
?<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>
2019-04-02
跟大小寫沒關系吧 直接window.open("http://www.xianlaiwan.cn","...");這樣就行了吧?感覺用confirm方便些
2019-04-01
W大寫
2019-03-29
function window()寫錯了,Window而不是window,
window.open(
's'
,
'_blank'
,
'width=400,height=500,menubar=no,toolbar=no,?status=yes?,scrollbars=yes'
)
s不用打引號,打了引號表示你打開了一個網址是s的網站,沒有這個網站。你直接打一個s,引用的就是你上面s參數保存的網址