可以添加自定义的Select控件
1.控件dom
<select name="WebSiteTarget" id="WebSiteTarget" class="w1" onchange="editable2(this);">
<option value="-1">请选择城市</option>
<option>福州</option>
<option>厦门</option>
<option>南平</option>
<option value="0">(自定义输入)</option>
</select>
2.脚本
<script>
function editable2(dom) {
if (dom.value == "0") {
var newvalue = prompt("请输入", "");
if (newvalue) {
addSelected(dom, newvalue, newvalue);
}
}
} function addSelected(fld1, value1, text1) {
if (document.all) {
var Opt = fld1.document.createElement("OPTION");
Opt.text = text1;
Opt.value = value1;
fld1.options.add(Opt);
Opt.selected = true;
} else {
var Opt = new Option(text1, value1, false, false);
Opt.selected = true;
fld1.options[fld1.options.length] = Opt;
}
}
</script>
3.效果

可以添加自定义的Select控件的更多相关文章
- jquery 双向select控件bootstrap Dual listbox
http://www.cnblogs.com/hangwei/p/5040866.html -->jquery 双向select控件bootstrap Dual listboxhtt ...
- SELECT控件操作的JS代码示例
SELECT控件操作的JS代码示例 1 检测是否有选中 if(objSelect.selectedIndex > -1) { //说明选中 } else { //说明没有选中 } 2.动态创建s ...
- HTML的select控件美化
HTML的select控件美化 CSS: .div-select { border: solid 1px #999; height: 40px; line-height: 40px; cursor: ...
- IE6下div层被select控件遮住的问题解决方法
Select在IE6下是处于最顶层的,因此想要遮住它,设置zIndex属性是不行的,就需要一个优先级更高的元素,就是iframe,当把iframe嵌套在弹出div层中后,把iframe设置为不可见,但 ...
- .net获取select控件中的文本内容
.net获取select控件中的文本内容 2009-11-28 21:19小V古 | 分类:C#/.NET | 浏览1374次 <select id="SecType" st ...
- Jquery 操作Html 控件 CheckBox、Radio、Select 控件 【转】http://www.cnblogs.com/lxblog/archive/2013/01/09/2853056.html
Jquery 操作Html 控件 CheckBox.Radio.Select 控件 在使用 Javascript 编写前台脚本的时候,经常会操作 Html 控件,比如 checkbox.radio ...
- js+CSS实现模拟华丽的select控件下拉菜单效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Asp.net绑定带层次下拉框(select控件)
1.效果图 2.数据库中表数据结构 3.前台页面 <select id="pid" runat="server" style="width:16 ...
- Selenium webdriver 之select 控件封装,解决onchange问题
使用webdriver的时候,select 控件经常会绑定onchange 事件,在selenium2.09 之前click 方法对onchange 事件有bug,2.09 以后修复了,但是根据经验也 ...
随机推荐
- Gym 100971C 水&愚&三角形
Description standard input/output Announcement Statements There is a set of n segments with the le ...
- L#中 int.TryParse 有问题
今天发现了一个 L# 的异常..因此记录一下 List<string> strList = new List<string>(); ; i<; ++i) { ; j< ...
- HTTP Header中Accept-Encoding
HTTP Header中Accept-Encoding 是浏览器发给服务器,声明浏览器支持的编码类型[1] 常见的有 Accept-Encoding: compress, gzip //支持comp ...
- 获取当前应用程序实例(instance:HINSTANCE)(转)
if using MFC AfxGetInstanceHandle(). For console programs, call GetConsoleWindow() to get the HWND t ...
- linux程序运行浅析
例如有一个脚本文件tests.sh,内容如下: #!/bin/bash #This is a sample test. cd /tmp echo "Hello, this is a test ...
- usb 2.0 支援的速度
from http://www.usb.org/developers/docs/usb20_docs/ high speed : 480 Mb/s full speed : 12 Mb/s low s ...
- (1)WCF托管
wcf 托管方式有很多种,常见的托管方式,iis,was,控制台,winfrom等. 先创建一个wcf服务 IService1.cs using System.ServiceModel; namesp ...
- [Machine Learning with Python] Data Preparation through Transformation Pipeline
In the former article "Data Preparation by Pandas and Scikit-Learn", we discussed about a ...
- Go语言调度器之主动调度(20)
本文是<Go语言调度器源代码情景分析>系列的第20篇,也是第五章<主动调度>的第1小节. Goroutine的主动调度是指当前正在运行的goroutine通过直接调用runti ...
- springboot 2.0.8 跳转jsp页面
springboot项目创建教程 https://blog.csdn.net/q18771811872/article/details/88126835 springboot 2.0跳转 html教程 ...