how to simulate a button click on loading a page

Hi experts

I need a button to be programatically clicked when a page loads... how would I go about doing that?

I saw some things about a doClick function, but you'll have to talk to me like I'm 5 years old here.  I tried the doClick and it didn't work.


John AccountAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

//something like this ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
function clickbtn()


<BODY onload = "clickbtn()">
<INPUT TYPE="text" NAME="txt">
<INPUT TYPE="reset" id= "breset">
<INPUT TYPE="button" id = "btn" value = "Click Me" onclick = "alert ('Hello World')">
//another ex
<form action="">
  <input type="hidden" name="x" value="1">
  <input type="submit" name="a" value="a">
  <input type="submit" name="b" value="b">

<input type=button value="simulate a click" onClick="document.forms[0];">
<input type=button value="simulate b click" onClick="document.forms[0];">
I think only IE allows button .click()
I was wrong the above works in all browsers. This seems simpler

<body onload="; ">

<form action="" name="f1">
   <input name="i1" type="button" value="simulate a click" onClick="alert('hi from the button')"> </p>


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John AccountAuthor Commented:
Great GwynforWeb... that worked like a charm!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.