Showing and hiding controls is a common requirement for a web application. This is how you do it using javascript.
Snippets:
To show:
document.getElementById('<%= textboxToUse.ClientID %>').style.display = '';
To hide:
document.getElementById('<%= textboxToUse.ClientID %>').style.display = 'none';
Where in:
textboxToUse.ClientID returns the id of the control.
Works on IE and Firefox.
Attached is the sample code which includes static and dynamic version.
Dynamic version was created in ASP.Net 2.0.
To check the dynamic just run the Sample.sln file while default.htm for static.
Download Sample (11.83 kb)
Wednesday, April 16, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
More Examples bro.... Javascript man...
Wala bago comments?
Post a Comment