做了一个效果,不知道大家能不能用上 有点小问题,第一次会把原来的选项“333”覆盖掉,并且会多出来一项“Other..”,但是实际使用当中似乎这个Other选项没有什么作用。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 like this?<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>New Page 1</title></head><script>function selectOther(list) {var input = document.createElement("INPUT");input.className = "select";input.type = "text";input.onblur = function() {var list = this.oldNode;list.options[list.options.length - 1] = new Option(this.value, "", true);list.options[list.options.length] = new Option("Other...");list.selectedIndex = list.options.length - 2;this.parentNode.replaceChild(list, this);};input.oldNode = list.parentNode.replaceChild(input, list);}</script><body> <p><select size="1" name="D1" onchange="if(this.selectedIndex==this.options.length-1)selectOther(D1)"> <option>111</option> <option>222</option> <option>333</option> <option>Other...</option> </select></p></body></html> 请教打开本地HTML资源的问题,谢谢,有经验的都来看看吧 用js替换字符串中的字符 问2个超级小问题,速来速得,谢谢捧场! 在线请教:JS实时更新时间 问题 一个正则表达式请教 实现不同用户登陆,文本框的赋值问题 当点一个frameset的右上角的关闭按钮时,如何使frameset不关闭 如何得到剪切板数据? 帮帮忙看看这两中提交方法错在哪儿?谢谢 请问各位,怎么用alert()显示变量的值, 如何用程序关闭浏览器? 翻页功能
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 1</title>
</head>
<script>
function selectOther(list) {
var input = document.createElement("INPUT");
input.className = "select";
input.type = "text";
input.onblur = function() {
var list = this.oldNode;
list.options[list.options.length - 1] = new Option(this.value, "", true);
list.options[list.options.length] = new Option("Other...");
list.selectedIndex = list.options.length - 2;this.parentNode.replaceChild(list, this);
};
input.oldNode = list.parentNode.replaceChild(input, list);
}
</script>
<body>
<p><select size="1" name="D1" onchange="if(this.selectedIndex==this.options.length-1)selectOther(D1)">
<option>111</option>
<option>222</option>
<option>333</option>
<option>Other...</option>
</select>
</p>
</body>
</html>