How to call a javascript function from a HTML button on a user control

How to call a javascript function from a HTML button on a user control

am 20.08.2005 07:45:25 von J-T

I have a user control called "Test1" with two button on it ,one is input and
the other one is a server control as follow:

onClick="this.disabled=true;document.getElementById(btnSend) .click();value="Go!">
Text="HiddenControl" Visible="False">

As you can see the asp.net button is calling a java script function as
follows:



when I run this code I get a java script error that "btnSend" is undefined
which generated from the first line (HTML button).I don;t know how to call
click even of server control from the html control.Dose anyone know how to
tackle this problem?

Thanks a lot

Re: How to call a javascript function from a HTML button on a user control

am 20.08.2005 08:30:21 von Lucas Tam

"J-T" wrote in
news:eGryVpUpFHA.3084@TK2MSFTNGP09.phx.gbl:

> when I run this code I get a java script error that "btnSend" is
> undefined which generated from the first line (HTML button).I don;t
> know how to call click even of server control from the html
> control.Dose anyone know how to tackle this problem?

You need to retrieve the rendered button name by using the property
btnSend.clientID.
--
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Re: How to call a javascript function from a HTML button on a user control

am 20.08.2005 08:36:52 von J-T

You mean I should replace btnSend with btnSend.clientID in
document.getElementById(btnSend).click();?

Thanks
"Lucas Tam" wrote in message
news:Xns96B8197D55CCCnntprogerscom@127.0.0.1...
> "J-T" wrote in
> news:eGryVpUpFHA.3084@TK2MSFTNGP09.phx.gbl:
>
>> when I run this code I get a java script error that "btnSend" is
>> undefined which generated from the first line (HTML button).I don;t
>> know how to call click even of server control from the html
>> control.Dose anyone know how to tackle this problem?
>
> You need to retrieve the rendered button name by using the property
> btnSend.clientID.
> --
> Lucas Tam (REMOVEnntp@rogers.com)
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/

Re: How to call a javascript function from a HTML button on a user control

am 20.08.2005 08:46:15 von Mark Rae

"J-T" wrote in message
news:eGryVpUpFHA.3084@TK2MSFTNGP09.phx.gbl...

> As you can see the asp.net button is calling a java script function as
> follows:
>
>