求助 !最后打開的窗口一直打不開網(wǎng)頁
<!DOCTYPE?html>
<html>
<head>
????<title>?new?document?</title>
????<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"?/>
????<script?type="text/javascript">
????????var?tip?=?confirm("在?打開網(wǎng)頁?");
????????if?(tip?==?true)?{
????????????var?address?=?prompt("Please?input?web?address",?"http://idcbgp.cn/");
????????????function?openWindow()?{
????????????????window.open('address',?'_blank',?'width=400px',?'height=500px');
????????????}
????????}
????????else?{?}
????</script>
</head>
<body>
????<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>
</body>
</html>
2020-01-07
好像邏輯就錯了吧,函數(shù)openWindow()
應(yīng)該把'var?tip?=?confirm("在?打開網(wǎng)頁?");'包住吧;另外,"http://idcbgp.cn/"里的“:”為中文狀態(tài)下的,改為英文狀態(tài)下的:
<!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?tip?=?confirm("在?打開網(wǎng)頁?");
????????if?(tip?==?true)?{
????????????var?address?=?prompt("Please?input?web?address",?"http://idcbgp.cn/");
??????????? //function?openWindow()?{
????????????????window.open('address',?'_blank',?'width=400px',?'height=500px');
?????????? // }
????????}
????????else?{?}
?? }
????</script>
</head>
<body>
????<input?type="button"?value="新窗口打開網(wǎng)站"?onclick="openWindow()"?/>
</body>
</html>
2020-01-07
最后打開網(wǎng)址前應(yīng)在加個判斷,否則點(diǎn)取消也會打開個空網(wǎng)址