<html> <head> <script type="text/javascript" src="jquery-1.4.1.js"></script> <script type="text/javascript"> $("document").ready ( function() { $('#class1').bind('click',function(){ $('p').removeClass('cp'); $('p').removeClass('cp2'); $('p').removeClass('cp3'); $('p').addClass('cp1'); }); $('#class2').bind('click',function(){ $('p').removeClass('cp'); $('p').addClass('cp2'); $('p').removeClass('c1'); $('p').removeClass('cp3'); }); $('#class3').bind('click',function(){ $('p').removeClass('cp'); $('p').removeClass('cp2'); $('p').removeClass('cp1'); $('p').addClass('cp3'); }); $('#laijing').bind('click',function(){ restCheck(); // var anArray=[61680001]; $('#61680001').attr("checked", true); }); $('#wangyu').bind('click',function(){ restCheck(); var anArray=[61680002]; $('#61680002').attr("checked", true); }); } ); //重置所有check box function restCheck() { $("input[name='twolevel']").each(function() { $(this).attr("checked", false); }); } </script> <style type="text/css"> .cp { text-size:10; } .cp1 { text-size:20; background-color:red; } .cp2 { text-size:30; background-color:blue; } .cp3 { text-size:40; background-color:black; } </style> </head> <body> <div> <a id="class1" href="#">变红</a> <a id="class2" href="#">变蓝</a> <a id="class3" href="#">变黑</a> </div> <p class="cp"> 你好点就撒了水 </p> <input id="laijing" type="button" value="laij"> <input id="wangyu" type="button" value="wangy"> <ul> <li>城市 <ul> <li> <input id="61680001" name="twolevel" type="checkbox" value="61680001">广州</li> <li> <input id="61680002" name="twolevel" type="checkbox" value="61680002">北京</li> </ul> <li> </ul> </body> </html>
版权声明:本文为zhiming_817原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。