這樣為什么會彈出兩次確認窗口?。?/h1>
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ??
? ? var xql=confirm("是否打開窗口");
? ? // 新窗口打開時彈出確認框,是否打開
? ? if(xql==true)
? ? {
? ? ? ? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? }
? ? else
? ? {
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ??
? ? var xql=confirm("是否打開窗口");
? ? // 新窗口打開時彈出確認框,是否打開
? ? if(xql==true)
? ? {
? ? ? ? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? }
? ? else
? ? {
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-03-23
第一次是編輯器里邊的,第二次是在瀏覽器上的
2018-03-23
<!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 xql=confirm("是否打開窗口");
??????? if(xql){
??????????? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
??????? } ?
??? }
? </script>
?</head>
?<body>
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2018-03-23
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>className屬性</title>
??? <script type="text/javascript">
?? ?? ?
??? // 新窗口打開時彈出確認框,是否打開
??? function openWindow(){
??????? var xql = confirm("是否打開新窗口?");
??????? if(xql==true){
??????????? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');
??????? }
??????? else{
??????????? alert("打開失敗");
??????? }
??? }
?? ?</script>
</head>
<body>
?? ?
??? <input name="button" type="button" onClick="openWindow()" value="點擊" />
?? ?
</body>
</html>