how can you call a javascript function inside of asp.net?

trend

Centurion
Joined
Oct 12, 2004
Messages
171
I have some html code:
<font color="#0D4985">Click </font> <a href="javascript:hideMe();">

that I need to convert to asp.net

I will need to
javascript:hideMe();

when the asp.net page loads. (well.. It can stay open if a login attempt just failed)

any ideas?

thanks
Lee
 
It's kind of vague what you're trying to do but...

You could make the link a LinkButton instead of a html anchor (it will display the same), and then on your post back if the login fails do nothing, but if it's successful hide the button by setting it's visiblility to false...but then most login pages go to a differant screen after successful login attempts so I don't know why you would stay on the same page.

If your trying to hide the button so they can't click it more than once you can add the following the button's on load event:

if(btnOk.Attributes("onclick")==null)
{
btnOk.Attribute("onclick") = "javascript:hideMe();"
}

And then do the same code as I mentioned above to hide the button if necessary.

Also you should use

<span style="color: #0D4985;">Click</span><a href="javascript:hideMe():">

instead of the font tag...it's deprecated I believe.
 
Back
Top