課程
/前端開發(fā)
/JavaScript
/JavaScript進階篇
<script type="text/javascript">
document.write("JS進階篇");
alert("關(guān)注JS高級篇");
</script>
2018-05-27
源自:JavaScript進階篇 1-1
正在回答
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>我們互動下</title><script type="text/javascript">??? document.write("JS進階篇"+"<br>");??? function tc(){??????? alert("關(guān)注JS高級篇");??? }</script></head><body>??? <input type="button" value="點擊我" onclick="tc()";/></body></html>
把document.write 內(nèi)容輸出命令 和 alert分開就好了
alert會阻塞所有線程,document.write已經(jīng)執(zhí)行了只是沒有顯示出來。
慕斯156508 提問者
慕斯156508 提問者 回復(fù) 慕斯156508 提問者
網(wǎng)頁先加載彈窗啊,這個問題不大。你可以在JS進階篇旁邊加個按鈕,跟alert綁定onclick事件
舉報
本課程從如何插入JS代碼開始,帶您進入網(wǎng)頁動態(tài)交互世界
2 回答為什么我的“JS進階篇”顯示兩遍
5 回答JS進階篇學習什么?
3 回答<script type="text/javascript"> document.write("JS進階篇"); alert("關(guān)注JS高級篇"); </script>
3 回答為什么會橫著出現(xiàn)兩次”JS進階篇”
1 回答為什么行不通JS進階篇9-16
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-07-18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我們互動下</title>
<script type="text/javascript">
??? document.write("JS進階篇"+"<br>");
??? function tc(){
??????? alert("關(guān)注JS高級篇");
??? }
</script>
</head>
<body>
??? <input type="button" value="點擊我" onclick="tc()";/>
</body>
</html>
把document.write 內(nèi)容輸出命令 和 alert分開就好了
2018-05-27
alert會阻塞所有線程,document.write已經(jīng)執(zhí)行了只是沒有顯示出來。
2018-05-27
網(wǎng)頁先加載彈窗啊,這個問題不大。你可以在JS進階篇旁邊加個按鈕,跟alert綁定onclick事件