Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random page in popup!

Status
Not open for further replies.

HuggerFanta

Technical User
Apr 22, 2002
87
SE
Hello Experts!
I need some help with random function!

This is what I whant to do:

1. I whant to load a pop-up.
2. In the pop-up I got 3 different pages that are going to be loaded.
3. I whant them in a random order.

Is this possible?

/ huggerFanta --------------------------------------
Kind regards;
HuggerFanta
 
hi,
ru using database for this?
anyway u can do something like this

<?
$myarray = array(&quot;page1.php&quot;, &quot;page2.php&quot;, &quot;page3.php&quot;);
$rn = mt_rand(0, (count($myarray)-1));
$page = myarray[$rn] ;
?>


then u can pass the variable $page to a javascript function
which opens a pop-up page ..something like..
<script..>

function popuppage(page) {
msgWindow = window.open('','newwin'...);
msgWindow.location.href = page ;
}

</script>

<a href = javascript:popuppage(<? echo $page; ?>)>Click to open popup randomly</a>


cheers

spookie
--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
OK!
Tried that, did not work!

Where should I put the array code??? --------------------------------------
Kind regards;
HuggerFanta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top