sponsored links

实用CSS技巧(不断更新...)

使文本框内的文字居中:
style="text-align: center"
强制设置下拉列表框长度:
<select name="selectObj" title="selectObj" style="width:250px">
</select>
设置表格行当鼠标移入时变色,移出行时恢复:
<TR bgcolor="#ffffff"
onMouseOver="this.style.backgroundColor='#fee5ca'"
onMouseOut="this.style.backgroundColor='#ffffff'">
使链接变成按钮:
<a href="javascript:dispDetail('${returnCard.tid}');" >查看详细</a>
设置表格的行高:
<tr height="10"></tr>或<td height="100"></td>
设置表格的单元格为过渡颜色:
<td style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#5AAFE2,endColorStr=#ffffff)"></td>
定义一个DIV,固定长和宽,并设置滚动,可把循环的数据在里边输出从而保证页面上某些元素的固定位置:
<div  id="layer" style=" width:90%;position:absolute; height:490px; z-index:1; left: 50px; top: 50px; overflow:auto" >
<c:foreach var="obj" items = "listValue">
....
</c:foreach>
</div>
<center>
<!--下边这三个按钮的位置是固定的-->
<input name="add" type="button" id="add" value="新增">
<input name="edit" type="button" id="edit" value="编辑">
<input name="del" type="button" id="del" value="删除">
</center>
用DIV模拟带图片的按钮效果,当鼠标移动到"按钮"上方时,"按钮"背景变色,移出时,"按钮"恢复原背景色
<div style= "border:1px   solid   #000000; width:60;height:25" onclick="clickAdd(this);" id="buttonAdd" onMouseOver="this.style.backgroundColor='#fee5ca'" onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/add.gif">新增
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25" onclick="clickEdit(this);" id="buttonEdit" onMouseOver="this.style.backgroundColor='#fee5ca'" onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/edit.gif">编辑
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25" onclick="clickSave(this);" id="buttonSave" onMouseOver="this.style.backgroundColor='#fee5ca'" onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/save.gif">保存
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25" onclick="clickDel(this);" id="buttonDel" onMouseOver="this.style.backgroundColor='#fee5ca'" onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/x.gif">删除
                    </div>

arrayScore[j].readOnly=1;//用JS设置页面文本框为只读状态
arrayScore[j].readOnly=0;;//用JS设置页面文本框为去掉只读状态,注意"readOnly"的大小写

Tags: CSS