document.write
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math </title>
<script type="text/javascript">
document.write(Math.floor(3.3)+ "<br>"+"無(wú)法顯示");
document.write(Math.floor(-0.1)+ "<br>");
document.write(Math.floor(-9.9)+ "<br>");
document.write(Math.floor(8.9));
</script>
</head>
<body>
</body>
</html>
發(fā)現(xiàn)頁(yè)面不會(huì)出現(xiàn)結(jié)果,求大神指點(diǎn)哪里錯(cuò)誤
2016-10-28
每句代碼結(jié)尾的分號(hào)應(yīng)該是英文的分號(hào)
2017-05-28
<script type="text/javascript">
var b = [3.3,-0.1,-9.9,8.9];
for(var i=0;i<b.length;i++){
? ? document.write(Math.floor(b[i])+"<br />")
}
</script>
這樣寫(xiě)比較簡(jiǎn)便
2016-10-28
分號(hào)錯(cuò)了,要么刪掉要么改成英文分號(hào),不過(guò)我們要注意培養(yǎng)編程語(yǔ)言的書(shū)寫(xiě)習(xí)慣,加上英文分號(hào)
2016-10-28
均以英文分號(hào)結(jié)尾