有下面这三种简单语句。
document.getElementsByTagName('body')[0].className = 'snow-container'; //设置为新的
document.getElementsByTagName('body')[0].className += 'snow-container'; //在原来的后面加这个
document.getElementsByTagName('body')[0].classList.add("snow-container"); //与第一个等价
测试一:
<!DOCTYPE html>
<html> <head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.snow-container {
background-color: red;
}
</style>
<script type="text/javascript">
window.onload = function() {
document.getElementsByTagName('body')[0].className = 'snow-container'; //设置为新的
document.getElementsByTagName('body')[0].className += 'snow-container'; //在原来的后面加这个
document.getElementsByTagName('body')[0].classList.add("snow-container"); //与第一个等价
}
</script>
</head> <body class="test"> </body> </html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAE1CAIAAAD28wf0AAAgAElEQVR4nO2da1hU16H394d8e7+8fTLn6eW8bfq2TdL39FTSeE6TIvScpz3t2/btk9PGdJKYjLeQtISSpOZGKirRUZwigkZQHGXiiAKDXAYVGREVBlFBGOWio3L3AjiAFxgYELPeD/sye8+NYWbDgu3///wen5k1a6/1X2vv/Z+19wwjQxgGAABAmNB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC+AwAAUAD0HQAAgAKg7wAAABQAfQcAAKAA6DsAAAAFQN8BAAAoAPoOAABAAdB3AAAACoC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+JVCEEQNAcUdpj6WpZ6pJ6GjcgWouHzUbwybdERTYn738BhisUpBEFzUzNymV+ikzwVYlHnJ0x1Le5//YYpkhSCoDmsGfgAyusbUX7DtIWUtAQXpkhSCILmtuT/ahT7jShBJRrCMETX4n5ACPflJ+GeKaMhGoZE6Lh/W3T8TVXu/gC+GgVB0FyX7F/ar9Yg+CAIevyEPyeFIAiSQQhTCIIgGYQwhSAIkkEIUwiCIBmEMIUgCJJBCFMIgiAZhDCFIAiSQQhTCIIgGYQwhSAIkkEIUwiCIBmEMIUgCJJBCFMIgiAZhDCFIAiSQQhTCIIgGYQwhSAIkkEIUwiCIBmEMIUgCJJBCFMIgiAZhDCFIAiSQQhTCIIgGYQwhSAIkkEIUwiCIBmEMIUgCJJBCFMIgiAZ9P8BqFkO5mzJRHoAAAAASUVORK5CYII=" alt="" />
测试二:
<!DOCTYPE html>
<html> <head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.snow-container {
background-color: red;
}
</style> </head> <body class="test"> </body>
<script type="text/javascript">
document.getElementsByTagName('body')[0].className = 'snow-container'; //设置为新的
document.getElementsByTagName('body')[0].className += 'snow-container'; //在原来的后面加这个
document.getElementsByTagName('body')[0].classList.add("snow-container"); //与第一个等价
</script> </html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsAAAAEvCAIAAADEt+ByAAAgAElEQVR4nO2de1gc533v5zwnPUl7zh/Jk23TS9rkRHHSk7QijdvEsaW2T3pSNU1O0tYJiRVj2bLiFBMljuNgXOGEWMgykWUk2yBhLGEhJCSQxE1CIAlJaBEgYVhJgISABXTlsiz3ZReB/Z4/ZnZ29gqzXIY1n8/zefQss++885vZEe9335ldJCFJiIiIiLo0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSI0/gKEBERMeI0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSI0/gKEBERMeI0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSI0/gKEBERMeI0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSI0/gKEBERMeI0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSI0/gKEBERMeI0vgJERESMOI2vABERESNO4ytARETEiNP4ChARETHiNL4CREREjDiNrwAREREjTuMrQERExIjT+AoQEREx4jS+AkRERIw4ja8AERERI07jK0BERMSIU7ICAAAA6IQAAQAAALohQAAAAIBuCBAAAACgGwIEAAAA6Ea6OXBv/rxhn+jqd3X0jXf0jXf0OsK0b7zT5uzqd92wT8xrtYiIiDhD5zFAyOnh6k376dorx07XzsbTtVeau2xkCERExEWidMM+MU929busvY5T1Zfab9yxDzvsww77yHg4DjusN+6cqr5k7XXIGQIRERGNVboxcG+e7Ox3WfvGj56utQ87bMPjfUNO27ArXMePnq619o139rvmr2Ccjdbe8XOXOgsrG/NOWRa/xeYm8+Uua++44ccNETFClbrsE/Nkh83Z3jNWcrrGPjzeN+zsGQrf3iFnyema9p6xDptz/grGsG3vdRSda7zS3j04NuGcfH/xOzg20WjtKaxsbO9xGH70EBEjUanLfm+e7LC52nscJadr+4fHe4ec3UOusO0dcpacrm3vcXTYXPNXMIbtuUudV9q7DY8Fer3S3n3uUqfhRw8RMRJd6ACRsLczdlf7M+90/nRX+092tP5oW8v3fnf1mxsbVyZeWv5c/SfX1330xxc++mj1Rx+u+sjXTn3sa6cJEBFhYWVjpMw9+MxDFJubDD96iIiRqNTZPzFPWvucbd1jxRU1/cPjPUPOu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AAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADdECAAAABANwQIAAAA0A0BAgAAAHRDgAAAAADd/H+sqS9drXfhZwAAAABJRU5ErkJggg==" alt="" />
小结:JS放在body与head中的不同
放在body和head其实差不多的,只不过是文档解析的时间不同。浏览器解析html是从上到下的。
如果把javascript放在head里的话,则先被解析,但这时候body还没有解析,所以$(#btn)会返回空值。如果把javascript放在head里的话,一般都会绑定一个监听,当全部的html文档解析完之后,再执行代码:
$(document).ready(function(){
//这里放入执行代码
})
一般情况下最好是单独把javascript放在js文件里,通过head里的<script
src="file.js"></script>链接起来,css则是通过<link>。这样做的目的是为了让内容-样式-逻辑分离,以便以后能够更好地维护。