Random text link..

They have: 117 posts

Joined: Jul 1999

Hi there,

Is there a javascript code that can "rotate" between two urls in the body tag?
like this:
<body onUnload="NewWin=window.open('1st URL','NewWin');">
and when the page refreshes...
<body onUnload="NewWin=window.open('2nd URL','NewWin');">

Thanks
Eitan Finkel

------------------
Top 10 Sponsors for your web site

A list of the Best Affiliate programs focusing on:
Pay per-lead Programs

They have: 48 posts

Joined: Dec 1999

I'm not sure if you can rotate between two different urls without using SSI or cookies, but I do have a code which will open a random url in a new window:

code:

<script language="JavaScript">
<!-- hidden
function get_random()
 {
  var ranNum=Math.round(Math.random());
  return ranNum;
 }

function get_link()
 {
  var gotolink=get_random()
  var ranlink=new Array(1)
   ranlink[0]="page1.html";
   ranlink[1]="page2.html";

  window.open(ranlink[gotolink],'windowname','height=480,width=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')
 }
//-->
</script>
<body onUnload="get_link()">
[/code]

Hope this is what you are looking for.  



------------------
Do you want to have fun?
TomWorld 

Do you want to have fun?
TomWorld

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

Never thought about it, but...Why not set a timeout in both pages that redirect to each other? Or, have a "hidden" href that automatically does it if the mouse runs over it?

Why would you want to swap on a refresh? Maybe you're looking at it the wrong way.

Vinny GrassBlade: cut&paste javascript

[This message has been edited by Vincent Puglia (edited 14 January 2000).]

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

They have: 117 posts

Joined: Jul 1999

Hey ..

Tom - This is exactly what i'm looking for

And vincent..
i can't decide which link will do better for me so i just wanted to randomize 'em.

Thank you!
Eitan

------------------
Top 10 Sponsors for your web site

A list of the Best Affiliate programs focusing on:
Pay per-lead Programs

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.