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

    Multiple Links - Next Button

    For some reason for the life of me I can't figure this out and posting on the forms is my last results.

    I'm trying to create something like this http://powerpetsplus.site88.net/guides/clicker.php

    You will see on top I'm trying to get a next button that will go to a new page. The url is something like petid1 and clicking next will go to petid2 and so on. (it's the end URL) example http://www.petadoptworld.com/pages/petpage.asp?PETID1 and I need it to go to http://www.petadoptworld.com/pages/petpage.asp?PETID2 and so on.

    I was able to do this with a help of a friend: http://o.aolcdn.com/hss/storage/fss/...test_next.html

    but for it to work we have to click the button then the link on top.

    What are we doing wrong?

    This is the coding I'm using now.

    <div id="test">

    <p>

    <input type="button" onclick="update();" value="Click me for the next pet">
    - <a id="test_link" href="http://www.petadoptworld.com/pages/petpage.asp?petid=1">
    Click Me

    <input id="previous" type="hidden" value="1"><br>

    </p>

    </div>

    <script type="text/javascript">

    function update()

    {

    var t1 = document.getElementById('test_link');

    var v1 = document.getElementById('previous');

    t1.href= "http://www.petadoptworld.com/pages/petpage.asp?petid=" + (parseInt(v1.value) + 1);

    v1.value = (parseInt(v1.value) + 1);

    }

    </script>

    I'm also trying to figure it out since 8000 are needed if the page is refreshed it remembers what one they are on.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,732
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by iBall View Post
    Doesn't look like the page in your link is safe. I get the attached warning message.
    No warning message from Avast or Malwarebytes.

    Your code has no closing </a> tag.

    But when you redirect to a new page the current page is wiped out, and when it is reloaded the count restarts at 1.
    Last edited by Philip M; 05-01-2012 at 01:18 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Tags for this Thread

    Posting Permissions

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