Calling client side event using javascript.

davearia

Centurion
Joined
Jan 4, 2005
Messages
184
Hi All,

What I am trying to do is probably ridiculously easy but I need your help.

For example I am trying to call the click event of button called Button1. Here is my attempt (line 6 being the line of importance):
Code:
1    <html xmlns="http://www.w3.org/1999/xhtml" >
2    <head runat="server">
3        <title>Ajax</title>
4    </head>
5    <body>
6        <script type="text/javascript">Button1.click();</script>
7        <noscript>alert("Disabled");</noscript>
8        <form id="form1" runat="server">
9        <div>
10           <asp:Button ID="Button1" runat="server" Text="Button"/></div>
11       </form>
12   </body>
13   </html>
14

This doesn't seem to work, can you help.

Cheers, Dave.
 
that doesnt look correct. You need the onClick event of the Button, name it for example, myButtonOnClick. Then have a function called myButtonOnClick and do whatever you need to do there.
 
Back
Top