PDA

View Full Version : Trouble making this script



rsvore
03-09-2005, 09:18 PM
I'm creating a simple script to redirect a page to a different html page by checking the day of the month. The script looks into the directory with the html pages listed 1 - 31 (i.e. 1.html, 2.html etc). What I want to do is make the javascript seach a particullar directory (menu) to find the html pages. Can any help?

I have the following directory:
-Website
--menu
---1.html
---2.html

Here is the script:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var today = new Date();
var day = today.getDate();
window.location = day + ".html";
// End -->
</SCRIPT>

In this line
window.location = day + ".html";
can I change it to
window.location = day + "/menu/.html";

Thanks,
Rob

_Aerospace_Eng_
03-10-2005, 12:28 AM
i dont believe that is what u want, that will just look for a file called .html in directories 1-31 with subdirectory of menu, try this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
<!-- Begin
var today = new Date();
var day = today.getDate();
window.location = "/menu/"+day+".html";
// End -->
</script>
</head>

<body>
</body>
</html>
that will start from the root directory then look in the menu folder and get the corresponding html file that matches the date