Another option to consider that will allow you to get away with purely client-side coding is storing these filenames in a delimited text file and then using a tfilereader object to read them back out again.
Code:
mydata.txt file:
@personname@|@department@
@Bob@|@Science@
@Joe@|@Art@
@Jane@|@Disciplinary@
myhtml.htm file:
<html>
<head>
<script language="JavaScript">
<!--
function change(filt){
filereader.FilterColumn = 'department';
filereader.FilterValue = filt;
filereader.FilterCriterion = '=';
filereader.Reset();
}
/* This function will check for a department name in the URL */
function checkQueryString(){
var querystring = location.search;
querystring = querystring.substring(1); //get rid of the question mark
var pairs = querystring.split("&");
for(var i = 0;i < pairs.length;i++){
var eq = pairs[i].indexOf("=");
if(eq != -1){
var argname = new String(pairs[i].substring(0,eq));
if(argname == "department"){
/* We have a department! :) Lets change the filter */
change(pairs[i].substring(eq+1));
}
}
}
}
//-->
</script>
<object id="filereader"
classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<param name="DataURL" value="mydata.txt">
<param name="UseHeader" value="True">
<param name="TextQualifier" value="@">
<param name="FieldDelim" value="|">
</object>
</head>
<body onLoad="checkQueryString();">
<input type="button" onClick="change('Disciplinary');" value="Disciplinary">
<input type="button" onClick="change('Science');" value="Science">
<input type="button" onClick="change('Art');" value="Art">
<table datasrc="#filereader">
<thead>
<th>Department</th>
<th>Employee</th>
</thead>
<tr>
<td><span datafld="department"></span></td>
<td><span datafld="personname"></span></td>
</tr>
</table>
</body>
</html>
Basically we have five differant pieces of functionality here.
1)The filereader object reads the contents of the files and uses the delimiters we provide(the pipe and at) to build an internal table of the data.
2)The table is defined to have it's source from the filereader, so it automatically fills it's contents (the spans) according to their own definitions (in this case the field names personname and department)
3)The javascript function change() is called with a value to filter the depertment column by, so only rows that have the given value will be displayed
4)The javascript function called checkQueryString() checks the URL to see if there is a department request, ie:
if there is then it automatically filters the table, if there isn't than it does nothing and the entire contents of the data file wil be displayed in the table.
This is a little complicated, but basically all you have to do to update the information is go into the data file and change it. Another option along the same vein is to create an xml file that can be treated the same way (more or less).
btw, the code above is mostly on the fly, but it should work, let me know if it doesn't.
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
This space has nothing in it, it's all ni your imagination