這樣寫可以嗎?還有沒有可以省略的步驟?
<!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 newpage=confirm("是否打開頁面?");
? ? ? ? if(newpage==true)
? ? ? ? {
? ? ? ? var open=prompt("輸入你想要打開的網(wǎng)頁","http://idcbgp.cn/");
? ? ? ? if(open="慕課網(wǎng)")
? ? ? ? {
? ? ? ? ? ? window.open("http://idcbgp.cn/","width:400","height:500","toolbar:no","menubar:no")
? ? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-11-06
? ? function openWindow(){
? ? ? ?if(confirm("是否打開頁面?"))
? ? ? ? {
? ? ? ? var open=prompt("輸入你想要打開的網(wǎng)頁");
? ? ? ? if(open=="慕課網(wǎng)")
? ? ? ? {
? ? ? ? ? ? window.open("http://idcbgp.cn/","width:400","height:500","toolbar:no","menubar:no")
? ? ? ? }
? ? }