<!DOCTYPE?html>
<html>
?<head>
??<title>?new?document?</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/>???
??<script?type="text/javascript">??
????
????//?新窗口打開時彈出確認框,是否打開
????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????function?openWindow(){
???????var?mymessage=confirm("是否打開網址");
???????if(mymessage==true){
????????var?myname=prompt("請輸入你要打開的網址:","http://www.xianlaiwan.cn/");
???????
????????window.open(myname,'_blank','width=400,height=500,menubar=no,toolbar=no,?)
???????}else{
???????????window.close
???????}
??????}
??</script>?
?</head>?
?<body>?
??<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>
2016-07-06
?????? var mymessage=confirm("是否打開網址");
?????? if(mymessage==true){
??????? var myname=prompt("請輸入你要打開的網址:","http://www.xianlaiwan.cn/");?????? ?
??????? window.open( myname,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
?????? }else{
?????????? window.close();
?????? }
代碼是沒問題 正常運行 可以打開其他網址 網址輸入的時候看看是不是沒有加上超文本傳輸協議 沒加的話是打不開的
2016-07-05
你這代碼,確定能運行嗎。。18行,你自己看看,沒有寫;也就算了,連'也忘記寫了啊。
2016-07-05
window.open('http://'+myname,'_blank','width=400,height=500,menubar=no,toolbar=no')
2016-07-05
你的代碼,我運行沒問題哦,刷新下如何?
2016-07-05
toolbar=on,逗號錯了