整个页面是主索引文件中的 PHP 包含。我应该将javascript放在主页上吗?或外部javascript文件?我引用 li 错误吗?
<ul>
<li class="about"><a href="index.php?about"><h1>about</h1></a></li>
<li class="team"><a href="index.php?team"><h1>team</h1></a></li>
<li class="training"><a href="index.php?training"><h1>training </h1></a></li>
<li class="courses"><a href="index.php?courses"><h1>courses</h1></a></li>
<li class="register"><a href="index.php?contact"><h1>contact</h1></a></li>
</ul>
<script type="text/javascript">
$("div").hover(
function () {
$(this).addClass("navhover");
},
function () {
$(this).removeClass("navhover");
}
);
</script>
(外部 CSS 页面)
<script type="text/css">
#center .navhover {
background: url(images/active.jpg) no-repeat center center;
}
#center .about {
background: url(../images/about.jpg) no-repeat center center;
}