Display / visible method in Javascript
-
Hi, I m using javascript to make a textbox visible, which is set to style=display:none at the page load.But when i click the button (On which javascript is method is called), the textbox doesnot makes it visible. I m doing protected void Page_Load(object sender, EventArgs e) { string str = "function radio()" + "{" + "if(document.getElementById('radio1').Checked!=true)" + "{" + "document.getElementById('" + TextBox1.ClientID + "').visible;" + "alert('sandeep');" + "}" + "}"; this.RegisterClientScriptBlock("clientScript", str); Button1.Attributes.Add("onClick", "radio()"); } Where i am going wrong... Thanx
-
Hi, I m using javascript to make a textbox visible, which is set to style=display:none at the page load.But when i click the button (On which javascript is method is called), the textbox doesnot makes it visible. I m doing protected void Page_Load(object sender, EventArgs e) { string str = "function radio()" + "{" + "if(document.getElementById('radio1').Checked!=true)" + "{" + "document.getElementById('" + TextBox1.ClientID + "').visible;" + "alert('sandeep');" + "}" + "}"; this.RegisterClientScriptBlock("clientScript", str); Button1.Attributes.Add("onClick", "radio()"); } Where i am going wrong... Thanx
sandeep kumar pundhir wrote:
"document.getElementById('" + TextBox1.ClientID + "').visible;" +
document.getElementById('" + TextBox1.ClientID + "').style.display = 'block';
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
sandeep kumar pundhir wrote:
"document.getElementById('" + TextBox1.ClientID + "').visible;" +
document.getElementById('" + TextBox1.ClientID + "').style.display = 'block';
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Thanx for ur reply. But now wat is hapening.... The textbox1 becomes visible for a second after clicking the button, it again disappears
-
Hi, I m using javascript to make a textbox visible, which is set to style=display:none at the page load.But when i click the button (On which javascript is method is called), the textbox doesnot makes it visible. I m doing protected void Page_Load(object sender, EventArgs e) { string str = "function radio()" + "{" + "if(document.getElementById('radio1').Checked!=true)" + "{" + "document.getElementById('" + TextBox1.ClientID + "').visible;" + "alert('sandeep');" + "}" + "}"; this.RegisterClientScriptBlock("clientScript", str); Button1.Attributes.Add("onClick", "radio()"); } Where i am going wrong... Thanx
"if(document.getElementById('radio1').Checked!=true)" + "{" + "document.getElementById('" + TextBox1.ClientID + "').style.display=block;" + "}" + "else"+ "{"+ "document.getElementById('" + TextBox1.ClientID + "').style.display=none;" + "}"+ "return false;"
Best Regard Pathan -- modified at 1:00 Friday 31st August, 2007---------------------------------------------------
-
Thanx for ur reply. But now wat is hapening.... The textbox1 becomes visible for a second after clicking the button, it again disappears
sandeep kumar pundhir wrote:
The textbox1 becomes visible for a second after clicking the button, it again disappears
Oh. Yeah. It will happen like that.. So, you have to cache the status (whether this is currently visible or not.) then, you have to set it back on Page Load.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)