Hi everybody,
I am trying to change cssClass for a cell table (td) which contatins a LinkButton(to navigate to home.aspx) by using onclick, onMouseOver and OnMouseOut.
onMouseOver and onMouseOut work good, But the problem is onclik, when the linkbutton within the cell is clicked the page is posted back and the cell gets its old cssClass from the markup. here is the code
<td class="MenuItem" id="MyTD" onmouseover="SetClass('MyTD', 'ItemMouseOver')" onmouseout="SetClass('MyTD', 'ItemMouseOut')" onclick="SetClass('MyTD', 'ItemMouseClick') >
<asp:LinkButton ID="lbHome" runat="server" Text="Home" OnClick="lbHome_Click"></asp:LinkButton>
</td>
//javascript
function SetClass(id, myclass) {
if (document.all(id).className != "ItemMouseClick") {
document.all(id).className = myclass;
}
}
I am trying to change cssClass for a cell table (td) which contatins a LinkButton(to navigate to home.aspx) by using onclick, onMouseOver and OnMouseOut.
onMouseOver and onMouseOut work good, But the problem is onclik, when the linkbutton within the cell is clicked the page is posted back and the cell gets its old cssClass from the markup. here is the code
<td class="MenuItem" id="MyTD" onmouseover="SetClass('MyTD', 'ItemMouseOver')" onmouseout="SetClass('MyTD', 'ItemMouseOut')" onclick="SetClass('MyTD', 'ItemMouseClick') >
<asp:LinkButton ID="lbHome" runat="server" Text="Home" OnClick="lbHome_Click"></asp:LinkButton>
</td>
//javascript
function SetClass(id, myclass) {
if (document.all(id).className != "ItemMouseClick") {
document.all(id).className = myclass;
}
}