Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: quick question

  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    quick question

    you know you have like a submit button on a page or whatnot, is there a way to make the button to be like auto clicked when the page is loaded?

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by helpmeplease11 View Post
    you know you have like a submit button on a page or whatnot, is there a way to make the button to be like auto clicked when the page is loaded?
    No, but why do you need that?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    yes, but it may not work for all browsers:

    <input type=button onclick="alert();" id=but1>

    <script type=text/javascript>
    function clickIt(){
    document.getElementById('but1').click();
    }
    window.onload=clickIt
    </script>
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    As far as I know, upon standars, a click() method does not initiate an event trigger. If (probably IE) a browser still allows that, my answer is still no. For me (and for other coders as well) if something works only for a single type of browser and if there is no equivalent for the others, that something does not exist
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    very true. but it does exsist, if only for IE. lol
    i would not reccomend using it on a website. only for local file use with IE.

    but like you ask above, why do you need that?


    back to helpmeplease11.
    if it is a submit button, you can also call submit() for the form via script:

    <form name=myform id=myform action=somepage.htm method=get>
    <input type=text name=text1 value=something>
    <input type=submit>
    </form>

    <script type=text/javascript>
    document.getElementById('myform').submit()
    </script>
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.


  •  

    Posting Permissions

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