|
-
Apr 4th, 2001, 07:02 AM
#1
Thread Starter
Lively Member
I have a dropdownlist on a form that contains data from a stored cookie. This is so the user has a dropdown filled with data specific to them.
What I want to do is let the user type in another value other than listed in the dropdown. Is there a way for the user to type in a value at the top of the list displayed in the dropdown?
I think I have seen this done but am not sure how to do it.
Thanks!
~Piz
-
Apr 4th, 2001, 05:43 PM
#2
Hi Piz,
Here is what i came up with.
Hope this helps
Code:
<html>
<head>
<script>
function additem(itemname)
{
if (itemname=="" )
{
alert ("Please enter any text");
return false;
}
var n;
n=document.frm1.cmb1.options.length;
var myArr = new Array (n);
for (i=0;i<n;i++)
{
myArr[i]=document.frm1.cmb1.options[i].text;
}
document.frm1.cmb1.options[0]=new Option(itemname);
for (j=0;j<myArr.length;j++)
{
document.frm1.cmb1.options[j+1]= new Option(myArr[j]);
}
document.frm1.cmb1.selectedIndex=0;
}
</script>
<title>Dan's AddItem</title></head>
<BODY bgcolor="#FFFFFF" >
<form name=frm1>
<select name=cmb1 >
<option value="Item1">Item1</option>
<option value="Item2">Item2</option>
</select>
<input name=txt1 >
<input type="button" name="Button" value="Add Item" onclick="javascript:additem(document.frm1.txt1.value)">
</form>
</body>
</html>
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 5th, 2001, 05:35 AM
#3
Thread Starter
Lively Member
thanks
Thanks! I will give this a shot......
~Piz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|