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 6 of 6

Thread: auto click??

  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    auto click??

    can someone help me to write a code to autoclick the following codes?
    note that the codes are partial codes.. help me to write the solution into a script file

    Code 1
    <table class="bgmain" width="99.75%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top">

    <form method="POST" action="tvalidate.php">
    <input type="hidden" name="id" size="20" value="29409"><input type="hidden" name="xfile" size="20"

    value="29409.pdf">&nbsp;<input type="submit" value="Download" name="Enter">
    </form>


    Code 2
    <div class="smallcurve">
    <div class="t"><div class="r"><div class="b"><div class="l"><div class="tl"><div class="tr"><div

    class="bl"><div class="br">
    <div class="smallcontent">

    <table width="100%" border="0" cellpadding="5" cellspacing="0" align="center"><tr><td>

    </ul>
    </td></tr></table>
    <center>
    <form method=POST action=http:blablabla.com/29409.pdf><b>Full-Text Document View/ Download :</b>
    <input type=image border=0 align=absmiddle src=./images/pimages.jpg title="Click here to view full-

    text item">

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,700
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    Do you need help or do you just want someone to create the code for you? If #1 applies then please show us what you have tried so far so someone can build upon that or show you the right apporach. If #2 applies then please make an inquiry in the marketplace section since this here is not the right section to request work to be done.

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here are some of the functions that i think is appropriate... (i found it over the internet)... (i just a beginner in c language so, it is kinda hard to write some of the java script functions since the syntax is different)..

    function mouseover()
    {
    time = 0.9E3; //clicks after 0.9s

    link = this;

    timeout = window.setTimeout(autoclick, time);
    }

    function clear()
    {
    link = null;

    if (timeout)
    {
    window.clearTimeout(timeout);
    }
    }

    function autoclick()
    {
    if (!timeout)
    {
    return;
    }

    document.location = link.href;
    }

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    So you don't *really* need an auto-click.

    You just want to jump to a different page after X amount of time?

    If you mean that you want those two <form>s to post, then you can't do it the way you are attempting, because the <form> data will *not* be sent along with the URL.

    The simple way is to call the submit() method on the <form>s involved.

    So, for example:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    setTimeout( "document.forms[0].submit()", 900 ); // submit first form on page in 900 milliseconds
    </script>
    </head>
    <body>
    .... body of the page ...
    </body>
    </html>
    If there is more than one <form> tag on the page and you want to submit other than the first one, change the number in document.forms[0].submit() to match.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    old pedant: I don't really understand what you mean. I rephrase my question.

    Code 1
    <table class="bgmain" width="99.75%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top">

    <form method="POST" action="tvalidate.php">
    <input type="hidden" name="id" size="20" value="29409"><input type="hidden" name="xfile" size="20"

    value="29409.pdf">&nbsp;<input type="submit" value="Download" name="Enter">
    </form>

    say code 1 is in file:///C:/Users/User/Desktop/page1.htm
    there is a button "Download" right? When I click it manually, it will go to file:///C:/Users/User/Desktop/tvalidate.php right?

    But, I don't want to click it manually, how can i skip to
    file:///C:/Users/User/Desktop/tvalidate.php after X seconds?
    [Without changing the codes in file:///C:/Users/User/Desktop/page1.htm]







    Code 2 is in file:///C:/Users/User/Desktop/tvalidate.php
    Code 2
    <div class="smallcurve">
    <div class="t"><div class="r"><div class="b"><div class="l"><div class="tl"><div class="tr"><div

    class="bl"><div class="br">
    <div class="smallcontent">

    <table width="100%" border="0" cellpadding="5" cellspacing="0" align="center"><tr><td>

    </ul>
    </td></tr></table>
    <center>
    <form method=POST action=http:blablabla.com/29409.pdf><b>Full-Text Document View/ Download :</b>
    <input type=image border=0 align=absmiddle src=./images/pimages.jpg title="Click here to view full-

    text item">


    there is a button "Full-Text Document View/ Download :" right? When I click it manually, it will go to http:blablabla.com/29409.pdf right?

    But, I don't want to click it manually, how can i skip to
    http:blablabla.com/29409.pdf after X seconds?
    [Without changing the codes in file:///C:/Users/User/Desktop/tvalidate.php]





    "The simple way is to call the submit() method on the <form>s involved.

    So, for example:
    Code:

    <html>
    <head>
    <script type="text/javascript">
    setTimeout( "document.forms[0].submit()", 900 ); // submit first form on page in 900 milliseconds
    </script>
    </head>
    <body>
    .... body of the page ...
    </body>
    </html>

    If there is more than one <form> tag on the page and you want to submit other than the first one, change the number in document.forms[0].submit() to match."

    writing a separate script file like what you said will work?
    Last edited by yongs; 08-29-2011 at 06:58 AM.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    Ahh...you added the poison phrase!
    Code:
    [Without changing the codes in file:///C:/Users/User/Desktop/page1.htm]
    *IF* the two pages are served FROM THE SAME DOMAIN, it can be done. You can have the master page "pop up" the "page1.html" and then it can control it the way I showed.

    But if your master page and the page you want to affect are from different domains (www.xyz.com versus www.abc.org or whatever) then you can't do it. It's a browser security issue.

    And completely different rules apply if you really do mean you want to do this with HTML files on the local machine, not the server.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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