我有一个使用 Bootstrap 3 表格的页面。该表包含各种链接,但我希望它在选择一个选项时禁用表链接。
我可以正常工作,但我需要对其进行样式设置,以便前端用户知道该表已禁用。
我的代码是:
<table class="table table-hover table-striped hidden-xs" id="clientListTable">
<tr>
<th>
<a href="<%=Html.GenerateLoopBackUrl(true, new { ClientList_SortOn = cell.SortOn, ClientList_SortDirection = sortDirection })%>"><%=cell.Value%></a>
<%if (showFilterOption)
{ %>
<a href="#" id="<%:cell.ColumnIdentifier%>_link" class="noPdf">
<span class="glyphicon glyphicon-filter" id="<%:cell.ColumnIdentifier%>_img"></span>
</a>
<%--<img src="<%= filterIcon%>" alt="add filter" id="<%:cell.ColumnIdentifier%>_img" />--%>
<%}%>
</th>
</tr>
<tr>
<%
foreach (var cell in row.Cells)
{
if (cell.Hidden) { }
else {%><td onclick="return clickDisableFunction();"><%=cell.Value%></td><%}
}
%>
</tr>
我的 Java 是
var clickedOnce = false;
function clickDisableFunction()
{
if (clickedOnce == true)
{
return false;
};
clickedOnce = true;
document.getElementById('clientListTable').setAttribute("disabled","true")
};
正如我所说,这按预期工作,但是当用户单击链接时,他们看不到所有其他链接在被重定向时已被禁用。
下面是相关表格的屏幕截图。
我只想让表格淡出(在链接点击时变成浅灰色)
最佳答案
决定使用模式作为一个选项,效果很好
关于javascript - 为禁用的 Twitter Bootstrap 表设置样式 单击表中包含的选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26103375/