為啥提交后點(diǎn)擊按鈕沒反應(yīng)呢?
function?openWindow(){?
var?message=confirm("是否打開窗口?");
if(message){
?var?url=prompt("確定打開的網(wǎng)址:",“http://idcbgp.cn/”);
???window.open(url,_blank','width=400,height=500,menubar=no,toolbar=no');?}
}?為啥運(yùn)行時(shí)點(diǎn)擊按鈕沒反應(yīng)呢?
2017-01-04
<!DOCTYPE?html> <html> ?<head> ??<title>?new?document?</title>?? ??<meta?charset="UTF-8">??? ??<script?type="text/javascript">?? ????? ?function?openWindow(){? var?message=confirm("是否打開窗口?"); if(message){ ?var?url=prompt("確定打開的網(wǎng)址:",'http://idcbgp.cn/'); ?if(url?!=?null){ ???window.open('url,_blank','width=400,height=500,menubar=no,toolbar=no'); } } ?}??? ??</script>? ?</head>? ?<body>? ??????<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>? ?</body>上述代碼可以正確運(yùn)行,你錯(cuò)誤的地方:1,prompt里面的網(wǎng)址引號(hào)是中文輸入法下的,應(yīng)該成英文,2,window.open后面少寫一個(gè)引號(hào)3,prompt后面應(yīng)該加一個(gè)判斷,當(dāng)prompt值不為空時(shí)再調(diào)用window.open方法打開網(wǎng)址
2017-01-03
<!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?message=confirm("是否打開窗口?"); if(message){ ?var?url=prompt("確定打開的網(wǎng)址:",“http://idcbgp.cn/”); ???window.open(url,_blank','width=400,height=500,menubar=no,toolbar=no');?} } ?? ???? ???? ??</script>? ?</head>? ?<body>? ??<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>? ?</body>補(bǔ)充一下,就是這個(gè)