日期:2014-05-16 浏览次数:20587 次
$("#id").click(function(){ $(this).addClass('actived'); });
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> New Document </title> <style type="text/css"> .visited{ color: #000000; } a{ color: #FF0000; } </style> <script type="text/javascript"> var current = null; function select(lnk){ if(current != null && current != lnk){ current.className = ""; } current = lnk; current.className = "visited"; } </script> </head> <body> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> <a href="#" onclick="select(this);">link1</a> </body> </html>