Random/Sequence Page Upon Refresh?

They have: 20 posts

Joined: Jan 2003

I've searched probably 2 dozen combinations of wording concerning this, and have found nothing. Figured it was time to ask here.

When someone is at the homepage of my site... I would like it to load a random or sequenced page, upon every refresh or revisit. For Instance:

If a viewer is at http://lacota.net/moo3outpost/pointofpresence/index1.html , and they were to hit the refresh button, or leave that particular page and then come back... i would like it to load http://lacota.net/moo3outpost/pointofpresence/index2.html and so on and so forth. Is this possible?

s0da's picture

He has: 157 posts

Joined: Mar 2004

Yes, it's possible. What language did you want to use to do this?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You can use something like an image rotator to do it, or have it be the same page and just load different content... Regardless, this is a scripting question, so I'm moving this thread. Smiling

They have: 20 posts

Joined: Jan 2003

javascript i suppose Smiling but any suggestions will do, i can find nothing on the subject

Chroder's picture

He has: 91 posts

Joined: Mar 2004

You can redirect with javascript, like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title> New Document </title>
    <strong>&lt;script language="javascript"&gt;
    var pages = new Array();
    pages[0] = 'http://google.com';
    pages[1] = 'http://yahoo.com';
    pages[2] = 'http://alltheweb.com';

    var rnd = Math.round(Math.random() * (pages.length - 1));

    top.location = pages[rnd];
    &lt;/script&gt;</strong>
</head>
<body>
</body>
</html>
'
(You can add/delete pages if you wish)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Hmmm.. I guess the question is why you're doing this. If you're sticking with Javascript I'll pop this back to the other forum. Please advise.

They have: 20 posts

Joined: Jan 2003

i just want the user to see something different on the homepage every once in a while.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

random content is different from a totally different page.

Do you want to have server-side scripting or just JavaScript?

You're not having different content on the home page, this way, you're having entirely different pages served. This could cause problems for people bookmarking the page then end up at instead of the main page if you intend on using JavaScript, meaning they would never see your changed pages, only the one that they bookmark.

They have: 20 posts

Joined: Jan 2003

well the two url's in my original post are the ones i want them to switch between, there will be more eventually, as you can see, only one graphic will be different... but the image is a table bg, so i think the image rotators are not what im looking for.... is there a better way to do this?

btw, thanks for all the help youve provided so far Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You can use image rotators anywhere. Even in a table background. Wink For what you want, it would be better not do it, though. That's main navigation! You don't want to randomize that?! If it's not navigation, whoa, it sure does look like it.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Ya.... JS image rotators are the best option. Keep the home page URL the same, and prevent confusion.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

And if you want to use server-side technologies, things like http://www.hiveware.com/imagerotator.php can be used easily in backgrounds or images.

They have: 20 posts

Joined: Jan 2003

wow, that should be perfect... but (theres always a but)... the nav and the big image below it both have to change together, but they are both seperate table bg's. If this rotator is random, and not sequenced, there could be complications (nav1 might be with image2, which wouldnt look right.... and vice versa) Im at work right now, so i cant test myself, thats why im asking so many questions Smiling thanks again for all your help

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If the nav and the background image are changing together, that's called a new page. Do NOT randomize the navigation!

They have: 20 posts

Joined: Jan 2003

so im back to my original problem Laughing out loud unless i wanna make the nav, and the image below, one big image... dont really wanna do that... but if it comes down it that i will.... any other suggestions?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Making a new page? No no, I mean that the navigation should be stable. Those pieces you want to have change look like navigation. If they aren't, the design is wrong. If they are, then don't make them random.

If you want to advertise that there are other sections, use a random news display or something, but keep the main navigation parts solid so that yourdomain.com/service.html is the same every time I go there. But yourdomain.com could have small "ads" instead of the section navigation that are random images.

I think you need to rethink what you're trying to do. Having randomized advertisements or section teasers is fine, but not the main navigation, which is what that big centre piece looks like.

They have: 20 posts

Joined: Jan 2003

well the nav "bar" stays relatively the same, nothing with the actual navigation changes between the two pages... its just the section teaser (good term suzanne) that really changes.

The nav picture, has a little chunk of that section teaser on it (thats because the drop shadow there will be screwed up if it doesnt)... so if the section teaser pic changes, the nav has to change accordingly... the actual navigation doesnt change... just the little bit below it, so it can match the section teaser... hope that came out right Smiling

if you go into the images folder... and look at nav1.gif, nav2.gif, refresh1.gif, and refresh2.gif... you should see what i mean

http://lacota.net/moo3outpost/pointofpresence

-

They have: 20 posts

Joined: Jan 2003

well, im home from work... and turns out that image rotator works perfect...

http://lacota.net/moo3outpost/pointofpresence to see the results, you may need to refresh it a few times to see the difference. It'll do until i get good at flash.

id like to thank everyone for all your help... great community here, and ill definetly be sticking around. Thanks again

sL|De

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

Since I didn't see any navigational elements at either of the two urls you posted I'm somewhat confused. However, if you simply wish to alter things 'randomly', why don't you place the random elements within divs and/or iframes (ilayer for NN4) and then swap the content whenever you wish? The url would remain the same, yet the content would change.

Vinny

Where the world once stood
the blades of grass cut me still

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.