Click to See Complete Forum and Search --> : Help Needed With XML Data


JGibbar
11-25-2007, 01:05 AM
Ok here is the deal, is need to use javascript to specify the name of an xml file using the input from a form on the same page. This is what I have:

<form name="navform" >
<select name="sport">
<option VALUE="x" SELECTED>Select a Sport</option>
<option VALUE="football">Football</option>
<option VALUE="soccer">Soccer</option>
<option VALUE="basketball">Basketball</option>
</select>
<select name="region">
<option VALUE="x" SELECTED>Select a Region</option>
<option VALUE="kysouthcentral">Ky South Central</option>

</select>
<input type="button" name="go" value="Get Ranks"
onclick="getscore()" />
</form>


Ok lets do this!
<script type="text/javascript" language="javascript">
function getscore() {
var ranking = "ranking"
sport = document.navform.sport.selectedIndex;
region = document.navform.region.selectedIndex;
sportval = document.navform.sport.options[sport].value;
regionval = document.navform.region.options[region].value;
if (sportval == "x" || regionval == "x")
alert("Select a Sport and Region.");
else if (sportval = "football" AND regionval = "kysouthcentral")
????WHAT NEEDS TO GO HERE TO TELL THE TABLE TO LOOK AT #RANK????
else alert("No Current Data Exists");
}
</script>

<xml id="rank" src="footballkysouthcentral.xml"></xml>
<xml OTHER XML FILES "></xml>
<xml OTHER XML FILES "></xml>

<table id="ranking" border="0">
<tr>
<td><b>Team</b></td>
<td><b>Rank</b></td>
<td><b>Last Week Rank</b></td>
<td><b>Season Recond</b></td>
</tr>
<tr>
<td><span datafld="team"></span></td>
<td><span datafld="rank"></span></td>
<td><span datafld="previous"></span></td>
<td><span datafld="record"></span></td>
</tr>
</table>

I need to tell the table which xml file to look at. How would I do that?