<!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 chuang=confirm("您要打開(kāi)一個(gè)新的窗口嗎?");? ? ? ? // 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)? ? ? ? var website;? ? ? ??? ? ? ? if(chuang==true)? ? ? ? { website=prompt("請(qǐng)確認(rèn)要訪(fǎng)問(wèn)的網(wǎng)址并確認(rèn)"?? ? ? ? ?,"http://idcbgp.cn" );? ? ??? ? ? ? }? ? ? ? ?else{}? ? ? ? if(website!=null)? ? ? ? {? ? ? ? window.open("website","_blank","width=100? ? ? ? ,height=500,menubar=no,toolbar=no")? ? ? ? }? ??? ? ? ?? ??? } ? ?? </script>??</head>??<body>? ?<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />??</body></html>
Javascript 2-7 編程練習(xí) 沒(méi)有效果 求指正錯(cuò)誤。
杰猛人
2015-04-18 17:24:02