select 下拉列表相关的问题
2011-11-30 15:55
555 查看
一.下拉列表多选
例子:
select 的multiple属性可以设置该下拉框是多选或者单选。multiple="multiple"以后,按住ALT键就可以多选了。
<select id="sel1" multiple="multiple">
<option value="1">A</option>
<option value="1">B</option>
<option value="1">C</option>
<option value="1">D</option>
<option value="1">E</option>
<option value="1">F</option>
</select>
二.下拉列表可选可编辑
自定义函数: ShowToText (将列表项中的值传递给文本)
function ShowToText (){
document.form_name.textfield_name.value=document.form_name.select_name.options
[document.form_name.select_name.selectedIndex].value;
}
自定义函数:ChangeWidth (动态改变文本框和下拉列表框的宽度,num为状态切换的判断参数)
function ChangeWidth(num){
if(num==1){
eval(document.form_name.textfield_name.style.width=0);
eval(document.form_name.select_name.style.width=180);
}else{
eval(document.form_name.textfield_name.style.width=160);
eval(document.form_name.select_name.style.width=20);
}
}
<form name="form_name" >
<input type="text" name="textfield_name" style="width: 160">
<select class="combox" name="select_name" style="width: 20" onChange="ShowToText();ChangeWidth(2)"
onMouseMove="ChangeWidth(1)" onBlur="ChangeWidth(2)">
<option></option>
<option value="车载机一厂">车载机一厂</option>
<option value="车载机二厂">车载机二厂</option>
</select>
例子:
select 的multiple属性可以设置该下拉框是多选或者单选。multiple="multiple"以后,按住ALT键就可以多选了。
<select id="sel1" multiple="multiple">
<option value="1">A</option>
<option value="1">B</option>
<option value="1">C</option>
<option value="1">D</option>
<option value="1">E</option>
<option value="1">F</option>
</select>
二.下拉列表可选可编辑
自定义函数: ShowToText (将列表项中的值传递给文本)
function ShowToText (){
document.form_name.textfield_name.value=document.form_name.select_name.options
[document.form_name.select_name.selectedIndex].value;
}
自定义函数:ChangeWidth (动态改变文本框和下拉列表框的宽度,num为状态切换的判断参数)
function ChangeWidth(num){
if(num==1){
eval(document.form_name.textfield_name.style.width=0);
eval(document.form_name.select_name.style.width=180);
}else{
eval(document.form_name.textfield_name.style.width=160);
eval(document.form_name.select_name.style.width=20);
}
}
<form name="form_name" >
<input type="text" name="textfield_name" style="width: 160">
<select class="combox" name="select_name" style="width: 20" onChange="ShowToText();ChangeWidth(2)"
onMouseMove="ChangeWidth(1)" onBlur="ChangeWidth(2)">
<option></option>
<option value="车载机一厂">车载机一厂</option>
<option value="车载机二厂">车载机二厂</option>
</select>
相关文章推荐
- jquery easyui校验select下拉列表值是否为空的问题
- 解决IE8中select下拉列表文字上下不居中的问题
- AngularJS下拉列表select在option动态变化之后多出了一个错误项的问题
- javascript取得单选radio、下拉列表值及相关问题记录
- qtp录制weblist select下拉列表的时候 遇到的问题总结
- knockout页面绑定下拉列表select选中项错误问题
- java开发中select下拉列表在查询操作中保留查询条件问题
- select网页下拉列表与div层遮盖问题
- Axure RP Pro - 相关问题 - 在规格文档中动态面板中的droplist下拉列表框部件会重复输出选项列表
- select网页下拉列表与div层遮盖问题
- Axure RP Pro - 相关问题 - 原型中Droplist“下拉列表”部件在IE6中总显示在最前面
- 关于list集合传到jsp,在struts的select标签中显示下拉列表问题
- struts标签 select 下拉列表赋初值问题
- 一般操作需要导入的jquery包(jquery.js包)和 jquery操作select下拉列表(取值及设置选中某一个option)
- 关于android的listview数据列表显示的下拉和刷新报错问题
- 关于angularjs的select下拉列表存在空白的解决办法
- 列表生成式相关技巧,相关问题
- 使用bootstrap-select完成可搜索的多选下拉列表
- IE中下拉列表遮盖问题的解决方法
- select 下拉列表获取选中的文本