...

View Full Version : Looking at how to limit a pull down



BrandeeA
02-22-2007, 03:17 AM
Hello Everyone,

I have a pull down that is months of the year, I would like to write something that will limit it to only show June. If they click on the pull down no other options appear. Is this doable in JS? Any suggestions? Thanks!

vwphillips
02-22-2007, 12:11 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
function Populate(){
var monthary=new Array('Month','January','February','March','April','May','June','July','August','Setember','October' ,'November','December');
var args=Populate.arguments;
var sel=document.getElementById(args[0]);
sel.options.length=0;
for (var zxc0=1;zxc0<args.length;zxc0++){
sel.options[sel.options.length]=new Option(monthary[args[zxc0]],args[zxc0],true,true);
}
sel.selectedIndex=0;

}
//-->
</script></head>

<body>

<input type="button" name="" value="Month 1 and 6" onclick="Populate('txt',0,1,6);" >
<input type="button" name="" value="Month 3 and 9" onclick="Populate('txt',0,3,9);" >
<select id="txt" ></select>
</body>

</html>

BrandeeA
02-23-2007, 04:08 AM
Thank you!:cool:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum