The below code show and hide a div on the imagebutton OnClientClick Client side event.
var state = 'none';
function showhide(divtest) {
if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval("document.all." + divtest+ ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[divtest].display = state;
}
if (document.getElementById && !document.all) {
hza = document.getElementById(divtest);
hza.style.display = state;
}
// To set focus to the div instead of scrolling
div1.scrollIntoView();
}
asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="showhide('div1');return false;" ImageUrl="~/NewImages/Email.png"
No comments:
Post a Comment