using javascript to change options
Posted: Mon Dec 02, 2002 4:51 pm
I have a member list and I want to change by what you can order it too
it's kinda like the member list on this forum only you can select information or Statistics. its set on information by default, and if you change it to Statistics, it gives you a different list to order by. so in information you have the choice to sort by name e-mail etc.. but in statistics you have kills, deaths, rank etc...
But when you change from stats to info it doesn't change the first one... does anyone know how to do this properly?
it's kinda like the member list on this forum only you can select information or Statistics. its set on information by default, and if you change it to Statistics, it gives you a different list to order by. so in information you have the choice to sort by name e-mail etc.. but in statistics you have kills, deaths, rank etc...
Code: Select all
<html>
<head>
<SCRIPT type="text/javascript">
<!--
function changeOrder(which) {
var x = document.forms.sortAndorder.order
if (which == "stats"){
x.options.id.first.text="Kills"
x.options.id.first.value="kills"
} else if (which == "info"){
x.options.id.first.text="Name"
x.options.id.first.value="name"
}
}
// -->
</SCRIPT>
</head>
<body>
<Form action="" method="post" name="sortAndorder">
Sort <select name="char_hench">
<option value="dbz_characters">Characters</option>
<option value="dbz_henchmen">Henchmen</option>
</select> By <select name="stats_info">
<option value="info" onSelect="changeOrder('info')">Information</option>
<option value="stats" onSelect="changeOrder('stats')">Statsitics</option>
</select> :
<br/>
Order <select name="order">
<option value="pname" id="first">Name</option>
<option value="alignment" id="second">Alignment</option>
<option value="email" id="third">E-mail</option>
<option value="active" id="fourth">Last Active</option>
</select> By <select name="ud">
<option value="ASC">Ascending</option>
<option value="DESC">Descending</option>
</select> <INPUT TYPE="submit" VALUE="Sort"></form>
</body>
</html>