Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Ok. I wish I knew how to search for this in the forum, but I don't know what this little set of code is called. I'm attempting to load a random HTML page from a small group of files I have. When this script runs it appears to grab my RANDOM.html page (good), but once it hits the script I'm running in RANDOM.html, it loads the one of the files from the group into a new window. Anyway...Here's the little code that I'm using:Code: Select all
<?php $page = $_GET['Page'];?>Code: Select all
<?php
if ($page == "arche") {
include("arche.html");
}
elseif ($page == "bolo") {
include("bolo.html");
}
elseif ($page == "contact") {
include("contact.html");
}
else {include("RANDOM.html");}
?>Code: Select all
<SCRIPT LANGUAGE="JavaScript">
var howMany = 2; // max number of items listed below
var page = new Array(howMany+1);
page[0]="a.html";
page[1]="b.html";
page[2]="c.html";
function rndnumber(){
var randscript = -1;
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1));
}
return randscript;
}
quo = rndnumber();
quox = page[quo];
window.location=(quox);
</SCRIPT>So I guess my question is this: Can I marry the 2 scripts together?
I really appreciate any help on this. I'm not a programmer by any means. So if you decide to help me out, please consider the person you are replying to has been kicked in the head repeatedly by a muel.
Thank you for your help.
Roger
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]