運(yùn)行完后有undefined并且沒有打開新窗口??
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>window對象</title>
<script type="text/javascript">
function openNew()
{
? ? document.write(alert("歡迎來到慕課網(wǎng)??!"));
? ? window.open('http://idcbgp.cn/','_blank','width=600','height=400');
}
</script>
</head>
<body>
<form>
<input type="button" value="點(diǎn)擊我,打開新窗口" onclick="openNew()" />
</form>
</body>
</html>
2018-11-17
呃呃,好像也沒影響
2018-11-17
window.open('http://idcbgp.cn/','_blank','width=600','height=400');后面的設(shè)置寬和高是在同一個參數(shù)里面,應(yīng)該是這樣'width=600,height=400'。
2018-07-18
document.write(alert("歡迎來到慕課網(wǎng)??!"));? 錯的
alert直接用就好不用加前面的是輸出到頁面
alert是瀏覽器彈窗
alert("歡迎來到慕課網(wǎng)!!")? 正確的
2018-07-16
個人理解alert()是彈出警告窗口,不可以用document.write()輸出文檔,所以提示沒有此屬性或者方法,去掉document.write()就可以了。