<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>