node2:/var/www/html/js#cat a15.html
<p id="green">tt</p>
<p id="red">tt</p>
<p id="tt">uuuu</p>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="a15.js"></script>
node2:/var/www/html/js#
node2:/var/www/html/js#cat a15.js
if (document.getElementById("tt")){
document.getElementById("tt").style.color="red";
}
将Id为tt的标记为红色