<!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 moren=confirm("打開新的頁面嗎?")//第一個(gè)彈窗,是否打開新頁面? ? if(moren==true)//點(diǎn)擊確定,則判斷為真,繼續(xù)以下動(dòng)作 { var url=prompt("請(qǐng)輸入網(wǎng)址,默認(rèn)網(wǎng)址:http://idcbgp.cn")//判斷真,進(jìn)入輸入網(wǎng)址階段 if(url==null)//留空,則打開http://idcbgp.cn {window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')} else if(url!=null)//輸入網(wǎng)址,則打開新網(wǎng)址。 {window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')} ? ? else {alert("再見咯!")}//不輸入內(nèi)容,點(diǎn)取消,提示再見. } ? ? else? { alert("拜拜咯!")//第一個(gè)彈窗階段,點(diǎn)取消則判斷假,拜拜! } ? }? ??? ??? </script>??</head>??<body>? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />??</body></html>
剛寫完,中途出現(xiàn)N個(gè)問題.終于完工.
菜鳥學(xué)前端
2019-05-06 17:38:34