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

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-01-2012, 09:11 AM   PM User | #1
InvalidEntry
New to the CF scene

 
Join Date: Nov 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
InvalidEntry is an unknown quantity at this point
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.
InvalidEntry is offline   Reply With Quote
Old 05-01-2012, 12:44 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
__________________

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.

Last edited by Philip M; 05-01-2012 at 01:18 PM..
Philip M is offline   Reply With Quote
Reply

Bookmarks

Tags
history, java, links

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 08:06 PM.


Advertisement
Log in to turn off these ads.