<html>
<head>
<style type="text/css">
a:active {color:green}
</style>
<script type="text/javascript">
function getfocus(){
document.getElementById('myAnchor').focus()
}
function lostfocus(){
document.getElementById('myAnchor').blue()
}
</script>
</head>
<body>
<a id="myAnchor" href="http://www.w3school.com.cn">访问 W3School.com.cn</a>
<br /><br/>
<input type="button" onclick="getfocus()" value="获得焦点">
<input type="button" onclick="losefocus()" value="失去焦点">
</body>
</html>