...

View Full Version : edit combo like browser combo



zuzupus
07-14-2003, 03:32 PM
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

Danne
07-14-2003, 04:23 PM
Have a look at this (http://www.webfx.eae.net/dhtml/combobox/combobox.htm).

zuzupus
07-15-2003, 09:40 AM
i no this site but i want soemthing like adress browser where we can type in anythign and then it will added up as well as we can delete by pressing backspace or delete from keyboard

thanks in advance

zuzupus
07-15-2003, 02:25 PM
lot of bugs in this site :( always i have to click on button to get the value of new item

any simple java script will really be appreciable

im wrote one script but i want to have adress bar browser not like buttons to add and delete

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT>

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></td><td><INPUT onclick=del() type=button value=Del>
</td></tr></table>
</FORM></CENTER>
</BODY>
</HTML>


thanks in advace for modify this script

Danne
07-15-2003, 03:22 PM
I thought you wanted a dropdown...

You can add and delete items using the keydown-event:


<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT>

function getKey() {
return (document.all ? event.keyCode : -1);// Add NS support
}


function add() {
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 onSubmit="return false;">
<input type=text name=t1 size=7 onkeydown="if(getKey()==13){add();this.value='';}"><BR>
<SELECT name=list size=6 onkeydown="if(getKey()==46){del();}">
<OPTION>Item 1
<OPTION>Item 2
<OPTION>Item 3
<OPTION>Item 4
</SELECT>
</FORM>
</CENTER>
</BODY>
</HTML>



This is for IE only and I have no idea how to use this on NS and Mozilla, but I'm sure you can find it searching the forum.

zuzupus
07-16-2003, 08:24 AM
hi,

thanks but i need drop down exactly like como box where i can add there and delete same like adress bar in browser and i dont want this <input type=text>

thanks for understanding

Danne
07-17-2003, 05:43 PM
I don't think that's possible using a <select> alone. You probably have to build your own control, like using the code above with the list inside a floating div which you hide/show.
Or try to use the one I linked to above.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum