Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
41
rated 0 times [  42] [ 1]  / answers: 1 / hits: 43099  / 12 Years ago, sat, april 28, 2012, 12:00:00

I have a button example below



<button id=startrunning>go</button>


There is no form or anything I'm using on the same page java script to detect it's click. It will work like I want it to when I click it. I want to see when the page is loaded it will automatically submit it's self is there a way?



Thank you


More From » button

 Answers
12

jsFiddle: http://jsfiddle.net/QEu84/10/



<script type=text/javascript>
function submit()
{
document.getElementById(startrunning).click(); // Simulates button click
document.submitForm.submit(); // Submits the form without the button
}
</script>

<body onload=submit()>
<form id=submitForm>
<button id=startrunning>go</button>
</form>
</body>

[#85908] Friday, April 27, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
andrewb

Total Points: 259
Total Questions: 124
Total Answers: 90

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;