이 jquery를 사용하십시오. 여기에 전체 HTML 코드를 붙여 넣습니다. 이것을 사용하십시오.
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<link type="text/css" rel="stylesheet" href=""/>
<style type="text/css">
#header ul {
padding-top:1em;
}
#header ul li a.currentpage {
color:white !important;
background-color: #F96E5B !important;
}
#header ul li a {
text-decoration: none;
color:#676767;
font-family: 'Oswald', sans-serif;
font-size: 1em;
float:right;
line-height: 3em;
padding-right: 1em;
padding-left:1em;
}
#header ul li a.active
{background-color: #F96E99;
color: white;}
</style>
</head>
<body>
<div id="header">
<img id="logo" src="images/logo.jpg">
<ul>
<li>
<a class="one active" href="#">CONTACT</a>
</li>
<li>
<a class="two" href="#">GALLERY</a>
</li class="one">
<li>
<a class="three" href="#">EVENTS</a>
</li>
<li>
<a class="four" href="#">HOME </a>
</li>
</ul>
</div>
<script type="text/javascript">
$("#header ul li a").click(function() {
$("#header ul li a").removeClass("active");
$(this).addClass("active");
})
</script>
</body>
</html>
데모 : http://jsfiddle.net/PbMg2/2/
당신이 jQuery를 사용할 준비가? – Selvamani
아니. 아직 jquery 모르겠다. 죄송합니다. 다른 아이디어가 있습니까? –
http://docs.jquery.com/ - 당신은 그것을 후회하지 않을 것입니다. :-) – techfoobar