日期:2014-05-17  浏览次数:20654 次

如何用jquery控制样式
代码如下:
<div id="fileupload">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>
如何控制id为fileupload下所有div的高度?比如,都为30像素

------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="jquery-1.5.2.min.js" type="text/javascript"></script>
<link type="text/css" href="css.css" rel="stylesheet" />
</head>
<script>
$(document).ready(function(){
$("#fileupload").find("div").addClass("st");
});
</script>
<style>

.st{
width:100px;
height:30px;
border:#0C6 1px solid;
}
</style>
<body>
<div id="fileupload">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>
</body>
</html>