Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-05-2009, 08:13 AM   PM User | #1
lihman
New to the CF scene

 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
lihman is an unknown quantity at this point
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?
lihman is offline   Reply With Quote
Old 09-05-2009, 09:25 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,184
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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?
Old Pedant is online now   Reply With Quote
Old 09-07-2009, 12:11 PM   PM User | #3
lihman
New to the CF scene

 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
lihman is an unknown quantity at this point
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.
lihman is offline   Reply With Quote
Old 09-07-2009, 12:20 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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?
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:05 AM.


Advertisement
Log in to turn off these ads.