怎么打不開啊 哪里錯了。。
?function openWindow(){
? ? ? ?var mychar=confirm("是否要打開新網址?");
? ? ? ?if(mychar==true){
? ? ? ? ? ?var url=prompt("確定打開的網址","http://www.xianlaiwan.cn/");
? ? ? ? ? ?if (url!=null){
? ? ? ? ? ? ? ?window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ?}
? ? ? ? ??
? ? ? ?}
? ? ? ?else
? ? ? ?{alert("再見");}
? ?}
2017-09-07
你的分號和冒號都是中文符的
2017-09-07
<!DOCTYPE html>
<html>
<head>
?<title> new document </title> ?
?<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> ?
?<script type="text/javascript"> ?
? ?
? ?function openWindow(){
? ? ? ?var a = confirm("是否打開?");// 新窗口打開時彈出確認框,是否打開
? ?if(a==true){
? ? ? ?window.open("http://www.xianlaiwan.cn/","_blank","width=400px,hight=500px,menubar=no,toolbar=no");
? ?}// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ?}//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ?
? ?
?</script>
</head>
<body>
? ? <input type="button" value="新窗口打開網站" onclick="openWindow()" />
</body>
</html>
2017-09-07
不用prompt,直接window.open就行了
2017-09-07
? <script type="text/javascript"> ?
? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? function openWindow(){
? ? ? ? var open = confirm("是否打開新窗口");
? ? ? ? if (open=turn){
? ? ? ? ? ? var url =prompt("通過對話框,確定打開網址","http://www.xianlaiwan.cn/");
? ? ? ? ? ? if (url!= null){
? ? ? ? ? ? ? ? window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ?
? ? ? ? ? ? }
? ? ? ? ? ?else{
? ? ? ? ? ? ? alert("SAY GOODBYE");
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? }
? ? ? ? ? ? ?else{
? ? ? ? ? ? ? alert("SAY GOODBYE");
? ? ? ? ? ? }?
? ? }
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?