<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){ $(".btn1").click(function(){ $("p").height("50%"); }); $(".btn2").click(function(){ $("p").height("20em"); });});</script></head><body><p style="background-color:yellow">This is a paragraph.</p><button class="btn1">把高度设置为 50%</button><button class="btn2">把高度设置为 20 em</button></body></html>