A better approach would be to have a static 'left' frame that links to a CGI that redirects to a random page.
Like so: <TD height = 33% align=center VAlign=center><a href="RandomPage.cgi" Target="main">This Link</a></TD> And then "RandomPage.cgi" just has to pic a random page, and return a redirect header to that page. ----- Original Message ----- From: "Rohesia Hamilton Metcalfe" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 29, 2002 1:55 PM Subject: Links to randomly-accessed html pages > Hello, > > I am working on a web project that will be using the srand function > both in the creation of html pages (some of the elements get randomly > selected from lists) and in the selection of pages to be called when > the user clicks certain links. > > So far, I can get what I need when I'm compiling a page dynamically, so > it's not the srand function that's the trouble, but the way I'm trying > to get the links to call randomly-accessed pages isn't working very > well. > > I've put the links in a cgi-compiled page in a "left" frame, to call > pages into the right, "main" frame of a page. The random link works > once and then the page needs to be refreshed before it will work again. > I can see that this is because I've created a $RandomPage variable from > the srand function which, once created, doesn't change until the cgi > script is run again from top to bottom, so I've tried various ways with > javascript to get the "left" page to refresh whenever the link is > clicked or whenever a new page is opened in the "main" window. None of > my javascript workarounds are working, and I wonder if there's a perl > way to get this script to re-run itself every time a user clicks a > link? > > Here's roughly the code: > > ################################# > > #!/usr/local/bin/perl5 > use CGI qw(:standard); > > #make array of pages available: > @Pages=("../page1.htm", "../page2.htm", "../page3.htm"); > > # pick one of the pages at random for This Link > srand; > $RandomPage = $Pages[int(rand(@Pages))]; > > print "Content-type:text/html\n\n"; > print <<EndOfHTML; > > <html> > <head> > <title>Title Here</title> > </head> > > <BODY> > <TABLE height = 100%><TR> > > <TD height = 33% align=center VAlign=center><a href="$RandomPage" > Target="main">This Link</a></TD> > > </TR><TR><TD>...</TD></TR><TR><TD>...</TD></TR> > </table> > > EndOfHTML > > print "</body></html>"; > > ######################################### > > Many thanks for all and any help in advance! > > Rohesia > > ===== > Rohesia Hamilton Metcalfe > > __________________________________________________ > Do You Yahoo!? > Yahoo! - Official partner of 2002 FIFA World Cup > http://fifaworldcup.yahoo.com > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]