Accessing the onClick of a button

Results 1 to 2 of 2

Thread: Accessing the onClick of a button

  1. #1
    Join Date
    Dec 1969

    Default Accessing the onClick of a button

    I have an ASP page with a button on it. When the page opens i want the button to be clicked without the user having to click the button, can i do this in code. Thanks.

  2. #2 Guest

    Default RE: Accessing the onClick of a button

    My first reaction would be why? But my second is to let you know that the on_click of a button usually references a clientside Javascript function that has code attached. What you could simply do is at the top of your page insert a clientside Javascript code block that calls the Javascript function of your button&#039s onclick event. E.g. <BR><BR>&#060;SCRIPT LANGUAGE=javascript&#062;<BR>&#060;!--<BR><BR> // Do onclick event<BR> <BR> button_onclick();<BR><BR>function button_onclick() {<BR><BR> alert(&#039Shit&#039);<BR><BR>}<BR><BR>//--&#062;<BR>&#060;/SCRIPT&#062;<BR><BR>&#060;INPUT type="button" value="Button" id=button name=button LANGUAGE=javascript onclick="return button_onclick()"&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts