點擊按鈕 不能運行= =
<!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 crel = confirm("Open a new window ?");
? ? if(crel == true){
? ? ? ? var prel = prompt("Input url:", "http://idcbgp.cn");
? ? ? ? window.open('prel', '_blank', 'width=400,height=500,menubar=no,toolbar=no');
? ? } ? ? ?
? ? else{
? ? ? ? alert("hi");
? ? }
? ? openWindow();
</script>
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onClick="openWindow()" />?
?</body>
</html>
2018-10-19
function openWindow()函數(shù)后面得有 { 啊,prompt是文本對話框,里面的內(nèi)容應(yīng)該是(“請輸入網(wǎng)址”)的文字而不是你的網(wǎng)址吧?
還有window.open()里得有網(wǎng)址啊,建議你下一個eclipse或者DW那里能幫你自動糾錯