這樣是對的嗎
function openWindow(){
??? var open = confirm("新窗口是否打開");
??? if(open==true)
??? {
??????? document.write("點擊彈出輸入對話框");
??? }
??? else{
???????
??? }
??? var k_open = prompt("確定打開的網址","http://www.xianlaiwan.cn/");
??? window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no')
???
??? }
2016-05-14
<!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 confi=confirm("是否打開?");
? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
? ? if(confi==true){
? ? var iUrl=prompt("請輸入網址","http://www.xianlaiwan.cn/")
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? if(iUrl!=null){
? ? ? ? window.open(iUrl,"_balnk","width=400,height=500,toolbar='no',menubar='no'");
? ? }
? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2016-05-13
不對。
第一,要求是點擊確認之后,還要彈出對話框,進行輸入想要跳轉的網址。意思是可以修改跳轉網址并選擇是否需要跳轉。你的會造成不管點沒點確定,都會直接跳轉,并且只跳轉一個默認界面。
第二,window.open語法有問題,末尾的狀態不需要加''。
這是我的,僅供參考。
?function openWindow(){
??? // 新窗口打開時彈出確認框,是否打開
??? var NeedNewUrl = confirm("要打開新的頁面嗎?")
??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
if(NeedNewUrl == true)
{
??? var openNewUrl = prompt("打開以下鏈接","http://www.xianlaiwan.cn/");
???? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
???? window.open(openNewUrl,'_self',width=400,height=500,menubar=no,toolbar=no);
}
2016-05-13
我用的是中文標點符號,,
2016-05-13
function openWindow(){
????????var?????op;
????????var????lk????=????confirm("打開新窗口?");
????if(lk){
????????var op =????prompt("確定打開的網站",“http://www.xianlaiwan.cn/“);
????????window.open(op,"_blnk","width=400,height=500,menubar=no,toolbar=no");
????}
}
瞧瞧行不
2016-05-13
你運行一下啊