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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to keep clicking a button

    I need to use javascript in a way in which it will keep clicking a button. The source code for that button is below:
    Code:
    <script type="text/javascript"> 
    function set_opacity(id, opacity) {
      element = document.getElementById(id)
      if (/MSIE/i.test(navigator.userAgent)) { element.style.filter='alpha(opacity='+opacity+')'; }
      else { element.style.opacity = opacity/100; }
      }
    </script> 
     
     
      <div class="recruiter_enabled"> 
        <table cellspacing="0" style="width: 100%"> 
          <tr> 
            <td> 
              
                <p> 
                  <script type="text/javascript"> 
    //<![CDATA[
    recruiter_clicks = 1
    //]]>
    </script><a href="/recruiter/recruit/3p5tjd4pdnbg0" id="recruit_link" onclick="return(submit_link_as_post_with_opacity(this, 'recruit_image'))"><img alt="" class="start_recruiting" id="recruit_image" src="/A.gif?1221518016" /></a><script type="text/javascript"> 
    //<![CDATA[
     
          link = document.getElementById('recruit_link');
          link_href = link.href;
          link.href = "#";
          set_opacity('recruit_image', 50);
          
          setTimeout("link = document.getElementById('recruit_link'); link.href = '" + link_href + "'; recruiter_clicks = 0; set_opacity('recruit_image', 100)", 2000);
        
    //]]>
    </script>
    Therefore, I need javascript to keep clicking the button until it has clicked it 375 times.

    How would I be able to do this?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Why do I get the feeling you are trying to cheat in some contest or such?

    Anyway, I don't see any button in there.

    If you mean the <a>, then as I read it, it will take you to another page. So how can you keep clicking on it when it no longer exists??

    Well...for the first 2 seconds on the page, clicking on the link will just cause the page to reload to the top of the page.

    But, still...

    Maybe you should show this page live? So we can fathom what you are after?

  • #3
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am trying to create a script that will click the "Recruit" button on a game. It is a link but the page it is linked to is almost identical. The recruit button stays at the same place. However, the destination of the link keeps changing.

    For example:
    <a href="/recruiter/recruit/3p5tjd4pdnbg0">

    The numbers after recruit/ change after every click. I basically need to use javascript to keep clicking the recruit link 375 times which I am now guessing is not a button but rather an image link with JS attached.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    I don't think that you are going to get much help in this forum with what amounts to cheating. Why not just enjoy the game?


  •  

    Posting Permissions

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