0
我想大膽的所有按鈕的JavaScript中的單擊事件在GridView的行做的GridView行,以便爲E,G我有這個按鈕大膽
<asp:button runat="server" text="Test" onclientClick="makerowsBold();"/>
。
我想大膽的所有按鈕的JavaScript中的單擊事件在GridView的行做的GridView行,以便爲E,G我有這個按鈕大膽
<asp:button runat="server" text="Test" onclientClick="makerowsBold();"/>
。
只要你使用jQuery,這應該工作:
CSS:
.bold { font-weight:bold; }
的JavaScript(用jQuery):
function makerowsBold() {
$('#idOfYourGridViewTable tr td').addClass('bold');
}
不知道什麼原因就不是有人堅持使用jQuery/MooTools /等。
function makerowsBold() {
var cells = document.getElementById("idOfYourGridViewTable").getElementsByTagName("td");
for (var i = 0; i < cells.length; i++)
cells[i].className += " bold";
}
這裏是fiddle。
我不使用jquery,你有在javascript解決方案。 –
不使用jQuery是愚蠢的 - 只是爲自己做更多的工作,但我會編輯我的答案。 – naspinski
是的,原因是我不熟悉jquery。 –