正常運行??梢猿霈F的網頁沒有如何內容 地址最后是 http://www.xianlaiwan.cn/code/sr 可明明輸入的是正確的地址啊。。求指教。謝謝
<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 sr =prompt("請輸入地址: http://www.xianlaiwan.cn");
??????????? if(sr="http: //www.xianlaiwan.cn"){
??????????????? window.open("sr","width=400,height=500,menubar=no,toolbar=no");
??????????? }else{
?????????????? window.close();
??????????? }
??????? }else{
?????????? window.close();;
??????? }
??? }
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網站" onclick="openWindow()" />
2019-05-28
//你可以參考這個試試,這個我就把中文字符改成英文字符了
2019-05-28
這個慕課網的地址,他的冒號用的是中文字符,“http: //www.xianlaiwan.cn”你可以注意一下,打開的地址,在慕課網前面還連著一串本地的地址,所以把冒號改成英文符號就好了,你試試。
2019-05-22
我好像懂了。if(sr="http: //www.xianlaiwan.cn"){
??????????????? window.open("sr","width=400,height=500,menubar=no,toolbar=no");}
這塊布可以這樣寫。
window.open(sr,"width=400,height=500,menubar=no,toolbar=no")
去掉sr的引號就ok了