The next thing we're going to do is place the java script (you'll edit this to suit your needs). Copy this code:
Now switch to either Code View or Split View and find the <body> tag. Make a new line and paste the code into that line.
This basically tells what file is to be called when a user chooses the two List Items. If you look at the lines of code you'll see the following: 1) We've named an element (tutorialfile) and have said what will be displayed in our iframe by default (in this case the file is called "default" but it could be anything -- "current", "newest", whatever you want). We defined this earlier when making the form. It's basically what's going to be displayed when a user comes to this page. 2) The next part of this script names the file to be displayed. The files in our "archive" were already named 012000, 022000, 032000, etc. which is why we used the values we did when making the form. This line also shows our files are in a directory called "tutorial_files". They will be drawn from our tutorial_files directory by "file" plus "year" plus ".htm". In this case our first List Item "file" has the values 01, 02, 03, 04 and 05 while the List Item Year has the values 2000, 2001, 2002. So if a user selected "File2" from year "2001" these values will call up 02+2001+htm in the tutorial_files folder or more specifically: tutorial_files/022001.htm We'll now change what occurs when our Button is "pushed". We want to specify that the above named file "tutorialfile" gets placed in the iframe when the button is clicked. Copy this code:
Find the input line for the button and mark it.
Paste the code you copied in place of the old.
Copy this code:
Now, find where the iframe is and mark the tags.
Paste the code in place of the other iframe tags.
At this point you may want to change the size of the iframe. If so, all you need to do is change the numbers in this line to what you want. Save your file and test it. It should work fine (well, if you have the correct folder name and your file structure match the List Item values...) I've found this to be a powerful tool for designing clean looking information pages. When a user comes to a page with all different kinds of articles or some such thing; instead of seeing a bunch of hyperlinked files by date or a huge drop down list (remember, after a few years of a weekly newsletter the list can get big) they can see a simple form, access the data they want and never leave the page. Oh, you can of course add more List Items (like a week or some other variable) which allows a wider spectrum of file name to be called up.
|