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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts

    I need help piecing this code together

    So I found this script that alerts the links of buttons on a site I use:
    Code:
    javascript: 
    
    array=document.getElementsByTagName('a');
    for (x in array){
        
        if (array[x].getAttribute('class')=="clickthru-link"){
            
            alert(array[x].href);
        }
    }
        void(0);
    Then I also found that you have to edit the script. This is what your suppose to do:

    At the beginning of code:
    Code:
    document.body.innerHTML+='<textbox id="sd"> </textbox>';
    and instead of alert:
    Code:
    document.getElementById('sd').value+= the href thing + "\n"
    The problem is I can't get it to work. I might be editing the code in the wrong places but I'm not sure.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    This makes no sense:
    Code:
    document.body.innerHTML+='<textbox id="sd"> </textbox>';
    (1) There is no such tag in HTML as <textbox>

    (2) If you meant <textarea>, then you should be adding the textarea to a <form>, in the proper place in the form, not just appending it to the end of the document.body.

    Maybe you need to show the actual page/code, not just an illegal fragment of it.
    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.

  • #3
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Old Pedant View Post
    This makes no sense:
    Code:
    document.body.innerHTML+='<textbox id="sd"> </textbox>';
    (1) There is no such tag in HTML as <textbox>

    (2) If you meant <textarea>, then you should be adding the textarea to a <form>, in the proper place in the form, not just appending it to the end of the document.body.

    Maybe you need to show the actual page/code, not just an illegal fragment of it.
    This actually is the whole code.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Well, there's still no such thing as <textbox>.

    But if this really is the entire code for the page, then there's no problem: Since there aren't any <a> tags in what you showed, your code that does getElementsByTagName("a") will never find any, and so there will never be anything to report. So you don't need any of this code.

    [In other words, I don't think I believe that this is *really* the "whole code".]
    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
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    If this is a homework assignment, maybe you need to go read the entire assignment again.

    If it's not homework, then maybe you could show us the actual web page you are trying to work with??
    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.

  • #6
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    as I said the script finds the links of buttons and displays them in an alert.One after another. This link is an example of one the script would display
    Code:
    <a href="/clickthrough/click/LDOsynZQAs6NNKrsOJcrqHcWQaQ_Iq2o5XzxYdLzv5EeZZz52RWSPg..">
    as for showing you the page. The site requires you to be a member to see any content. But luckily I have 2 accounts.

    1) Go to http://www.lockerz.com/profile/14225424
    2) Login with email as 'e.holloway01@yahoo.com' and password as 'hellboy98'
    3) It will redirect you to that page after login.
    4) Enter the script into the address bar on that page so you can see exactly what it does.
    Last edited by elitis; 12-27-2010 at 11:03 PM.

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    I believe you about that. But you still aren't addressing the other problems. Such as the fact that there's no such thing as <textbox>

    You say you don't want the list to appear via an alert() any more. Fine. So where *DO* you want it to appear???? In a <form> field? If so, where's the <form>? In a <div>?? If so, where on the page should the <div> appear?
    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.

  • #8
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Old Pedant View Post
    I believe you about that. But you still aren't addressing the other problems. Such as the fact that there's no such thing as <textbox>

    You say you don't want the list to appear via an alert() any more. Fine. So where *DO* you want it to appear???? In a <form> field? If so, where's the <form>? In a <div>?? If so, where on the page should the <div> appear?
    Ok, so when I use document.write instead of alert() it displays the link on the same page but only the first link. What I want it to do is display all the links on the page or go to the next link on a refresh.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    You can't use document.write after the page is created. It will WIPE OUT the existing page and replace it with ONLY what the document.write does. SO that explains that part.

    But what I don't get is why you want to display all the links as URLs??? I mean, they are already all there on the page a <a> tags, no?

    And as for going to "the next link on a refresh": Huh? What's your definition of "next link"? And what constitutes a refresh? The user hitting the F5 key or some JavaScript function that reloads the page or???
    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.

  • #10
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Old Pedant View Post
    You can't use document.write after the page is created. It will WIPE OUT the existing page and replace it with ONLY what the document.write does. SO that explains that part.

    But what I don't get is why you want to display all the links as URLs??? I mean, they are already all there on the page a <a> tags, no?

    And as for going to "the next link on a refresh": Huh? What's your definition of "next link"? And what constitutes a refresh? The user hitting the F5 key or some JavaScript function that reloads the page or???
    This will all be much easier if you login to the site so you can see everything I'm telling you for yourself. The links are all hidden and can only be found in the source code. I want document.write to wipe out the page and replace it with only what it does. As for going to the next link on a refresh. It really doesn't matter whether the refresh is made through a javascript function or through F5. I'll put it like this ANY time a refresh is made, I want it to display the next link.

    Or like I said if theres a way to get it to display all the links after replacing the page with what document.write does that would be good as well.

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Okay, now I see what you are trying to do.

    Sorry, I won't help you. It's unethical and quite possibly illegal, in that it likely violates the terms of the user agreement you almost surely had to sign.

    Maybe somebody else won't have my same scruples.
    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.

  • #12
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Old Pedant View Post
    Okay, now I see what you are trying to do.

    Sorry, I won't help you. It's unethical and quite possibly illegal, in that it likely violates the terms of the user agreement you almost surely had to sign.

    Maybe somebody else won't have my same scruples.
    how is it illegal to make a script that gets the links of buttons?

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Oh, come on.

    That's a site that (supposedly) pays you for reading advertisements. Obviously, they expect that if you read enough ads you'll eventually find something you will buy, so they get money from the advertiser and they share (a tiny bit of it, I'll bet) with you.

    But if you don't actually *read* the ads--if you use an automated script such as you want us to give you to skip through the ads as fast as possible--then of course there is no hope that you will buy anything, and so your use of their site is worthless to them.

    I am dead sure that when you signed up for this "service" you agreed to terms that, among other things, specified that you can't use an automated system to bypass the reading of the ads. By doing what you want to do, you are violating the terms of that agreement.

    Now, I'll grant you that the only penalties that anyone could impose on you are surely simply a loss of the benefits you would get if you did this legitimately. But technically what you are doing is fraud, and that is illegal. The fact that there's virtually no chance that you will be prosecuted for it doesn't make it less illegal.

    Part of me wants to help you, since I think all these surf-for-pay sites are themselves immoral and should be shut down. They surely are taking advantage of idiots who will end up spending more than they will ever "earn". But like them or not, they are legal. What you want to do is not. Unless you can prove to me that there is nothing in their agreement that says you can't do what you want to do.

    [And in any case, if you really wanted to do this "right", you wouldn't do it from JavaScript. You'd use PHP or some other server-side system.]
    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.

  • Users who have thanked Old Pedant for this post:

    Hashim1 (12-29-2010)

  • #14
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Old Pedant View Post
    Oh, come on.

    That's a site that (supposedly) pays you for reading advertisements. Obviously, they expect that if you read enough ads you'll eventually find something you will buy, so they get money from the advertiser and they share (a tiny bit of it, I'll bet) with you.

    But if you don't actually *read* the ads--if you use an automated script such as you want us to give you to skip through the ads as fast as possible--then of course there is no hope that you will buy anything, and so your use of their site is worthless to them.

    I am dead sure that when you signed up for this "service" you agreed to terms that, among other things, specified that you can't use an automated system to bypass the reading of the ads. By doing what you want to do, you are violating the terms of that agreement.

    Now, I'll grant you that the only penalties that anyone could impose on you are surely simply a loss of the benefits you would get if you did this legitimately. But technically what you are doing is fraud, and that is illegal. The fact that there's virtually no chance that you will be prosecuted for it doesn't make it less illegal.

    Part of me wants to help you, since I think all these surf-for-pay sites are themselves immoral and should be shut down. They surely are taking advantage of idiots who will end up spending more than they will ever "earn". But like them or not, they are legal. What you want to do is not. Unless you can prove to me that there is nothing in their agreement that says you can't do what you want to do.

    [And in any case, if you really wanted to do this "right", you wouldn't do it from JavaScript. You'd use PHP or some other server-side system.]
    reading ads? where do you see this? lockerz is a gpt (get paid to) site yes, but has nothing to do with reading ads. When you click the buttons (decalz) you earn points. What I'm trying to do is get the decalz links. Now tell me how that is fraud.

  • #15
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Excerpts from the terms that YOU agreed to when YOU signed up.
    The page is http://www.lockerz.com/terms

    Prohibited Activities You or anyone acting on your behalf or for your benefit may not create or use multiple, fake or temporary e–mail accounts, messages or related means, including, without limitation, creating or using websites or programs specifically designed to solicit information from individuals for purposes of inviting members, hacking into our system or creating or using programs to specifically circumvent proper and authorized use of our Website and its functionality for any purpose in conjunction with sending invites, earning PTZ or otherwise utilizing Website functionality and features. ... You may not abuse, manipulate, or engage in any activity related to Lockerz’ policies, practices or offerings to wrongfully earn or acquire PTZ, goods or services of any kind through Lockerz. ... You may not use, promote, or enable others to use or promote any device, software or routine that is intended to or likely to damage or interfere with the proper working of the Website or involves the use of deception, false information, fraud, manipulation, avoidance, or cheating of any kind, including, without limitation, creating or utilizing programs, scripts, bots, or any method to mimic or fake actual user activity on the Website, ...
    I rest my case.
    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.

  • Users who have thanked Old Pedant for this post:

    Hashim1 (12-29-2010)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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