Tabatha M Tabatha M - 4 months ago 49
Javascript Question

HTML button onload submit

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



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

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