CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Multiple Links - Next Button (http://www.codingforums.com/showthread.php?t=259404)

InvalidEntry 05-01-2012 09:11 AM

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.

Philip M 05-01-2012 12:44 PM

Quote:

Originally Posted by iBall (Post 1222618)
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.


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.