yanzilee9292 发表于 2013-2-7 17:24:35

Jquery的CSS操作

1. 添加样式
 

<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){$("button").click(function(){    $("p").css({"background-color":"red","font-size":"200%"});});});</script></head><body><h2>This is a heading</h2><p>This is a paragraph.</p><p>This is another paragraph.</p><button type="button">Click me</button></body></html> 
 
2.改变size
 

<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){$("button").click(function(){    $("#id100").height("200px");});});</script></head><body><div id="id100" style="background:yellow;height:100px;width:100px">HELLO</div><div id="id200" style="background:yellow;height:100px;width:100px">W3SCHOOL</div><button type="button">请点击这里</button></body></html>
页: [1]
查看完整版本: Jquery的CSS操作