1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>类别切换</title> 5 <script type="text/javascript" 6 src="Jscript/jquery-1.8.2.min.js"> 7 </script> 8 <style type="text/css"> 9 .clsImg{border:solid 1px #666;padding:3px} 10 </style> 11 <script type="text/javascript"> 12 $(function() { 13 $("img").click(function() { 14 $(this).toggleClass("clsImg"); //切换样式类别 15 }) 16 }) 17 </script> 18 </head> 19 <body> 20 <img src="Images/logo.gif" alt="" title="jQuery" /> 21 </body> 22 </html>