Show Item with javascript

Posted on: Mon Mar 02 12:16:38 -0800 2009. Updated on: Mon Mar 02 12:21:24 -0800 2009.
Category: Asp .Net AJAX / Javascript / CSS

function ShowItem(itemId) {
		var item = $get(itemId);
		if (item.style.display == "none" || item.style.display == "") {
			item.style.display = "block";
		}
		else {
			item.style.display = "none";
		}
	}

If you are using masterpages, you will want to do something like this in your CS codebehind:

HyperLinkLogin.NavigateUrl = String.Format("javascript:ShowItem('{0}');", LoginPanel.ClientID);

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.