PDA

View Full Version : sequential links



jusko
September 4th, 2007, 06:11 AM
Hey everyone!!

I have what i think it is a simple question to answer.
I have a button to open a new link in a new browser window. And what i need is that after i press the button, the link opened would come from a list of html. I have, for example, 10 html pages "page1.html", "page2.html", and so on.
I dont want that the html opened would be from a random choice, but i want to be sequential. Example: when someone press the button, it will open page1.html, then someone else press the button again (somewhere else in the world!) the page opened will be page2.html...
I hope that i'm being clear in my line of thought. Is this possible?

thanks people, and cheers!!!

RabBell
September 4th, 2007, 07:31 AM
The problem with client side is that it only works on the client side (someones pc). I don't think theres anyway this can be done...for instance you could try



<script language="javascript">
var num = 0

function oneclick()
{
num = num + 1
if num = 10 then num = 1
}

function gotolink()
{
oneclick()
if (num == 1) { self.location.href = "#"; }
if (num == 2) { self.location.href = "#"; }
etc.
}
</script>

<a href="javascript:gotolink()">CLICK HERE</a>


the reason this won't work is because when users come into the page num will always set itself to 0 on their machine so if you're on page 5 and I enter the site then I'll start at page 1 and you'll continue to page 6 so, no I don't think there's a way to do this using Client Side.

You need to use a server side language for this.