<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
<style>
.afterPreviousFont
{
position:absolute;
width:20;
overflow:hidden;
direction:rtl;
left:expression(this.previousSibling.offsetLeft+this.previousSibling.offsetWidth-1);
}
</style></head><body>可输入下拉框,用来凑热闹,没什么实际用途<br>
请输入:<input style="width:100" onchange="this.nextSibling.all[0].value=this.value;"><font class="afterPreviousFont" >
<select style="width:120" dir=ltr onchange="this.parentElement.previousSibling.value=this.value;"><option value="">
<option value="abcde">abcde</option>
<option value="this is jk glad to meet you">this is jk glad to meet you</option>
</select>
</font>
</body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
<style>
.afterPreviousFont
{
position:absolute;
width:20;
overflow:hidden;
direction:rtl;
left:expression(this.previousSibling.offsetLeft+this.previousSibling.offsetWidth-1);
}
</style></head><body>可输入下拉框,用来凑热闹,没什么实际用途<br>
请输入:<input style="width:100" onchange="this.nextSibling.all[0].value=this.value;"><font class="afterPreviousFont" >
<select style="width:120" dir=ltr onchange="this.parentElement.previousSibling.value=this.value;"><option value="">
<option value="abcde">abcde</option>
<option value="this is jk glad to meet you">this is jk glad to meet you</option>
</select>
</font>
</body></html>
<option value="11">aaa</option>
<option value="22">bbb</option>
</select>
是不是这个啊,说的不是很明白
<option value="1">11111111<option>
<option value="2">222222</option>
<option value="3">333333</option>
</select>
</span>
挺好
<head>
<title>可以编辑的下拉列表 - by WildWind<[email protected]>...</title>
<script language="JavaScript">
<!--
function catch_keydown(sel)
{
switch(event.keyCode)
{
case 13:
//Enter;
sel.options[sel.length] = new Option("","",false,true);
event.returnValue = false;
break;
case 27:
//Esc;
alert("text:" + sel.options[sel.selectedIndex].text + ", value:" + sel.options[sel.selectedIndex].value + ";");
event.returnValue = false;
break;
case 46:
//Delete;
if(confirm("删除当前选项!?"))
{
sel.options[sel.selectedIndex] = null;
if(sel.length>0)
{
sel.options[0].selected = true;
}
}
event.returnValue = false;
break;
case 8:
//Back Space;
var s = sel.options[sel.selectedIndex].text;
sel.options[sel.selectedIndex].text = s.substr(0,s.length-1);
event.returnValue = false;
break;
}
}
function catch_press(sel)
{
sel.options[sel.selectedIndex].text = sel.options[sel.selectedIndex].text + String.fromCharCode(event.keyCode);
event.returnValue = false;
}
//-->
</script>
</head><body onload="s1.focus();">
<h3>操作方法:</h3>
<p>
1.按Enter键开始添加输入新的选项...<br>
2.按Del键删除当前选项...<br>
3.按Esc键查看当前选项的text和value值...<br>
4.按BackSpace键删除当前选项的前一个字符...<br>
</p>
<h3>测试结果:</h3>
<p>
1.IE6.0测试通过...<br>
</p>
<br>
<h3>建议&意见:</h3>
<p>
1.大家可以做成htc,将这些函数绑在css上(很简单,不再介绍...)...<br>
</p>
<h3>示例:</h3>
<p>
<select name=s1 onkeydown="catch_keydown(this);" onkeypress="catch_press(this);" style="font-size:12px;"><option>---</option></select>
</p>
</body>
</html>