Click to See Complete Forum and Search --> : edit combo like browser combo


zuzupus
07-14-2003, 09:53 AM
hi,
anybody knows how to get combo box exactly like in browser,so that i can enter my own text in select or i can also delete and in the same time it also adds up exactly like internet explorer we can add edit delete or select
<select name="Sites">
<option value="yahoo">yahoo</option>
<option value="google">google</option>
<option value="msn">msn</option>
<option value="times">times</option>
</select>

this will only show but i cant add delete by own

anybody having any script i will be grateful

thanks in advance

Mr J
07-14-2003, 05:15 PM
Have a play with the following

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT>
function add() {
var newitem=prompt("Add To List Item","Your New Item Here");
document.form.list[document.form.list.length] = new Option(newitem, document.form.list.length);
}

function add2() {
var newitem=document.form.t1.value;
document.form.list[document.form.list.length] = new Option(newitem, document.form.list.length);
}

function del() {
if (document.form.list.selectedIndex >= 0) {
document.form.list.options[document.form.list.selectedIndex]=null;
document.form.list.selectedIndex=0;
}
}
</SCRIPT>


<h1>Adding/Deleting List Items</h1>
<center>
<FORM name=form>
<table border=0><tr><td align=right>
<input type=text name=t1 size=7><BR>
<SELECT name=list size=6>
<OPTION>Item 1
<OPTION>Item 2
<OPTION>Item 3
<OPTION>Item 4
</SELECT>
</td><td valign=top><INPUT type=button value=Add onclick=add2()></td></tr>
</tr><td><INPUT type=button value="Prompt" onclick=add()></td><td><INPUT onclick=del() type=button value=Del>
</td></tr></table>
</FORM></CENTER>
</BODY>
</HTML>

zuzupus
07-15-2003, 03:15 AM
thanks alot but i want soemthing like adress browser no prompt no add no del :)
exactly like address browser

thanks