為什么點了沒反應
<!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 open=confirm("是否新建窗口來打開網站?");
? ? ? if(open==true)
? ? ? ? ?{
? ? ? ? ? ? ?var address = prompt("請您輸入想打開的網站:","http://www.xianlaiwan.cn/");
? ? ? ? ? if(address!=null)
? ? ? ? ? ? ?{window.open('address','_blank','menubar=no,toolbar=no,height=500,weight=400');
? ? ? ? ? ? ?}
? ? ? ? ? ? ?else{
? ? ? ? ? ? ? ? ?alert("再見!");
? ? ? ? ? ? ?}
? ? ? ? ?}
? ? ? ? ?else{
? ? ? ? ? ? ? alert("保持在當前頁面");
? ? ? ? ?}
? ? ?}
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2018-07-26
<!DOCTYPE HTML>
?<html>
??<head>
???<script>
????function abb(){
????var aab=confirm("是否打開網址?")
????if(aab=true){
????var acc=prompt("請輸入網址","http://www.baidu.com")
?????if(acc!=null){
?????window.open('http://www.baidu.con','_blank','width=500,height=200,top=100,left=500','toolbar=no','menubar=no')
?????}
?????else{
?????alert("拜拜!")
?????}
????}
????else{
????document.write("拜拜哦!")
????}
????}
????function add(){
????abb.close();
????}
???</script>
??</head>
??<body>
???<input type="button" value="點擊進入網址" onclick="abb()">
???<input type="button" value="關閉網址" onclick="add()">
??</body>
??</html>
2018-07-24
我知道了,你的最后一個else的括號用成了中文狀態的了
2018-07-24
emem不知道怎么改,但是我的是這樣寫的,
<!DOCTYPE html>
<html>
?? ?<head>
?? ??? ?<meta charset="UTF-8">
?? ??? ?<script type="text/javascript">
?? ??? ??? ?// 新窗口打開時彈出確認框,是否打開
?? ??? ??? ?function open1(){
?? ??? ??? ??? ?var a1=confirm("是否真的打開新窗口?");
?? ??? ??? ??? ?if (a1==true) {
?? ??? ??? ??? ??? ?window.open();
?? ??? ??? ??? ?} else{
?? ??? ??? ??? ??? ?close();
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
?? ??? ??? ?function open2(){
?? ??? ??? ??? ?var a2=prompt("是否真的打開?");
?? ??? ??? ??? ?if (a2==0) {
?? ??? ??? ??? ??? ?window.open('http://www.xianlaiwan.cn/');
?? ??? ??? ??? ?}
?? ??? ??? ??? ?
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
?? ??? ??? ?function open3 () {
?? ??? ??? ??? ?window.open('http://www.xianlaiwan.cn','_blank','height=500,width=400,menubar=0,toolbar=0');
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ?</script>
?? ??? ?<title>我的練習</title>
?? ?</head>
?? ?<body>
?? ??? ?<input name="button1"? type="button" onclick="open1()" value="是否打開新窗口!"/>
?? ?</br>
?? ???? <input name="button2"? type="button" onclick="open2()" value="打開新網址"/>
?? ?</br>
?? ???? <input name="button3"? type="button" onclick="open3()" value="打開一個寬400像素,高500像素,無菜單欄、無工具欄的窗口"/>
?? ?</br>
?? ?</body>
</html>