<%@ Page Language="C#" AutoEventWireup="true" CodeFile="20110829.aspx.cs" Inherits="_20110829" %>
<!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 runat="server">
<title>CheckBoxList垂直方向对齐问题</title>
<script type="text/javascript" src="jquery.js" ></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBoxList ID="CbRoles" runat="server" RepeatColumns="3" Width="100">
</asp:CheckBoxList>
<script type="text/javascript" >
//$("tr:first").attr("valign","top");失败
//$("#CbRoles:tr:first").css("vertical-align", "top"); 失败
//$("tr:first").css("vertical-align", "top");失败
$("#CbRoles").find("tr").css("vertical-align", "top"); //OK
</script>
</div>
</form>
</body>
</html>
解决CheckBoxList垂直对齐问题
这篇博客讨论了在ASP.NET中遇到的CheckBoxList控件元素垂直对齐的问题。作者通过尝试不同JavaScript方法,最终找到了使用`$("#CbRoles").find("tr").css("vertical-align", "top");`来正确设置垂直对齐的解决方案。"
106869130,5073673,向量叉乘与反对称矩阵相乘的转换,"['线性代数', '矩阵运算']
410

被折叠的 条评论
为什么被折叠?



