View Full Version : This should be an easy one
zenweezil
05-05-2003, 12:09 AM
ok, I have a script that works fine. But what I want to do is add a pull down menu so the user can define one of the var that is currently just predefined in the script.
I'm sure this is an easy one. I just need a select menu so that once an item is selected the value of that item is now the defintion of the var
Thanks in advance.
HairyTeeth
05-05-2003, 12:30 AM
like this perhaps:
<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="javascript">
<!--;
function getVar(fld) {
var theVariable = fld.options[fld.selectedIndex].value;
switch(theVariable){
case "FooVar01":
alert(theVariable);
break;
case "FooVar02":
alert(theVariable);
break;
}
}
//-->
</script>
</head>
<body>
<form name="theForm">
<select name="selVar" onchange="getVar(this)" size="1" >
<option value="defaultSelected" selected="selected">Choose...</option>
<option value="FooVar01">var1</option>
<option value="FooVar02">var2</option>
</SELECT>
</form>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.