1

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.

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

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

What are we doing wrong?

THelper
  • 15,333
  • 6
  • 64
  • 104

1 Answers1

0

Hint: instead of assigning url to the link, use window.href = "myurl"; This will load your url in the current window (i.e., forward you to this url). EDIT: sorry, window.href doesn't work for all browsers, use window.location.href instead!

Igor Deruga
  • 1,504
  • 1
  • 10
  • 18
  • BTW, your "previous" field shouldn't work... It's 1 when the page loads. When you push the button, you calculate the value for your link: (parseInt(v1.value) + 1), which is 2. Then you assign this value to "previous" then you click the link and the page is loaded with the value 1 again. And everything goes around. Try using this to obtain your parameter: http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter – Igor Deruga May 03 '12 at 13:40