87,917
社区成员
发帖
与我相关
我的任务
分享
<ul class="hot-query" id="Hot-query">
{foreach from=$searchkeywords item=val}
<li><a href="search.php?keywords={$val|escape:url}" target="_blank">{$val}</a></li>
{/foreach}
</ul>
<script type="text/javascript">
$('ul li:eq(0)').css('color', '#ff6600');
document.getElementById("Hot-query").getElementsByTagName('li')[0].style.color = '#ff6600';
</script>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>6</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
//jquery:
$(function(){
$("#Hot-query li:eq(0)").css("color","#096");
});
//js:
window.onload=function(){
document.getElementById("Hot-query").getElementsByTagName('li')[0].style.color = '#ff6600';
};
</script>
</head>
<body>
<ul id="Hot-query">
<li>1111</li>
<li>2222</li>
<li>3333</li>
</ul>
</body>
</html>