為什么點按鈕沒反應(yīng)?
<!DOCTYPE HTML>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript">
? ? // 新窗口打開時彈出確認(rèn)框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ? function openWindow()
? ? {
? ? var message=confirm("是否打開新的網(wǎng)頁?");
? ? if(message==true)
? ? {
? ? var web=prompt("請輸入網(wǎng)址","http://idcbgp.cn/");
? ? ? ?if(web!=null)
? ? ? ?{
? ? ? ?window.open(web,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ?}
? ? ? ?else
? ? ? ?{
? ? ? ?alert("再見~");
? ? ? ?}
? ? else
? ? {
? ? alert("再見~");
? ? }
? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button"? value="新窗口打開網(wǎng)站"
? ?onClick="openWindow()"/>?
?</body>
</html>
2018-10-18
好像還多了個“}”號,建議你調(diào)整好格式
2018-10-18
這樣也可以,前面是我搞錯了,你錯的是onclick,c是小寫;可以直接用openWindow();直接調(diào)用函數(shù)調(diào)試
2018-10-16
window.open后面不能跟“web”,window.open([url],....),那個位置是url地址的