getElementById

node2:/var/www/html/jquery#
node2:/var/www/html/jquery#cat t12.html 
<li id='xx'>111111111</li>
<li id='yy'>222222222</li>
<li id='tt'>333333333</li>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="t12.js"></script>

node2:/var/www/html/jquery#cat t12.js
document.getElementById("yyhh").style.color="red";

猜你喜欢

转载自blog.csdn.net/zhaoyangjian724/article/details/88422638
今日推荐