這個(gè)是最標(biāo)準(zhǔn)的答案
<!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 yourconfirm = confirm("是否打開");
??????? if(yourconfirm==true){
??????????? var yourprompt = prompt("你的網(wǎng)址"," http://idcbgp.cn/")
??????????? if (yourprompt != null){
??????????? window.open(yourprompt,"blank","width=400,height=500,menubar=no,toolbar=no")}
??????????? }
??????????? }
????? ?
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2015-12-15
if(yourconfirm==true) 這里可以直接寫 if(yourconfirm)