請(qǐng)問(wèn)我的代碼哪里錯(cuò)了,為什么點(diǎn)按鈕沒(méi)反應(yīng)呢
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全帶,準(zhǔn)備啟航</title>
<script type="text/javascript">
function dui(){
? ? var a=confirm("準(zhǔn)備好了嗎?");
? ? ? ? if (a==true)
? ? ? ? {
? ? ? ? document.write("準(zhǔn)備好了"); ? ?
? ? ? ? }
? ? ? ??
? ? ? ? else
? ? ? ? {
? ? ? ? document.write("沒(méi)準(zhǔn)備好");
? ? ? ? }
? ? }
</script>
</head>
<body>
<input type="button" value="請(qǐng)點(diǎn)擊我" onclick="dui()">
</input>
</body>
</html>
2016-09-11
var a=confirm("準(zhǔn)備好了嗎?");?? //此處的分號(hào)用的是中文分號(hào)
? ? ? ? if (a==true)
? ? ? ? {
? ? ? ? document.write("準(zhǔn)備好了"); ? ?//此處的分號(hào)用的也是中文分號(hào)
? ? ? ? }
以上兩處分號(hào)改為英文分號(hào)就好了
2016-09-11
不能使用中文分號(hào)
2016-09-11
? document.write("沒(méi)準(zhǔn)備好")后面是中文分號(hào),在編碼中禁止使用中文符號(hào)。
2016-09-11
? document.write("沒(méi)準(zhǔn)備好")后面是中文分號(hào),在編碼中禁止使用中文符號(hào)。
2016-09-11
你的? ? var a=confirm("準(zhǔn)備好了嗎?")后面的';'以及? ? document.write("準(zhǔn)備好了")后面的';'寫成了中文的,用英文狀態(tài)下的輸入法就行了。?