點擊按鈕沒有反應(yīng),找不到哪里有問題
<!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 mymessage=confirm("是否打開網(wǎng)頁?");
? ? if(mymessage==true)
? ? {
? ? ? ? var mywin=prompt("請輸入網(wǎng)址");
? ? ? ? if(mywin!=null)
? ? ? ? {
? ? ? ? ? ? window.open('http://www.bilibili.com','_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? alert("告辭!");
? ? ? ? }
? ? }
? ? else
? ? {
? ? ? ? alert("再見!")
? ? }
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2020-03-30
你的function openWindow()少了{}
2020-03-29
我顯示的效果是正確的
unction openWindow(){
? ? ? ?var ask=confirm("您是否需要打開新窗口?");
? ? ? ?if(ask==true)
? ? ? ?{
? ? ? ? ?prompt("輸入需要打開窗口的網(wǎng)站 ","http://idcbgp.cn/");??
? ? ? ? ?window.open('http://idcbgp.cn/','_blamk','width=400,height=500,menubar=no,toolbar=no');
? ? ? ?}
? ? ? ?else{
? ? ? ? ? ?
? ? ? ?}
? ? }
你試試行不行
2020-03-28
你openWindow()函數(shù)的內(nèi)容應(yīng)該寫在{? }里面。