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