下拉菜单问题!急!今日必须解决!马上结帐! http://www.51windows.net/hw/asp/jsview.asp?id=318 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select己经有默认的keypress事件,就是轮流选择以所输字符打头的选项.现在楼主的要求似乎与这个大多数人已经认同的情形相悖!不可以因为某个使用者的想法破坏其他更多使用者的习惯 不过,想输入一个1000-9999的数值却采用下框(而不用input)真的有点夸张啊! 只是举例子说是1000-9999嘛,再说我自己都解决了,默认的keypress事件也可以让它不用嘛,代码如下:<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><script language="javascript">x="";str="1111111111";function aa(){ if (event.keyCode==27){ x=""; document.f1.s1.options[0].text=""; f1.s1.options[0].selected=true; }if (isNaN(parseInt(String.fromCharCode(event.keyCode)))==false){ if (x.length>=14){ x=String.fromCharCode(event.keyCode); event.returnValue = false;} else { x=x+String.fromCharCode(event.keyCode); event.returnValue = false;} } if (x.length<=str.length){ if(x==str.slice(0,x.length)){ document.f1.s1.options[0].text=x;}} else{document.f1.s1.options[0].text=x;} x=f1.s1.options[0].text;if (x.length==14){ for (n=1;n<f1.s1.length;n++){ if (f1.s1.options[n].text==x){ f1.s1.options[n].selected=true; document.f1.s1.options[0].text="";} } if (f1.s1.options[0].selected==true){ alert("输入错误!"); document.f1.s1.options[0].text="";} }}</script><body onLoad="f1.s1.focus();"><form name="f1"><select name="s1" onkeydown="aa();"><option selected></option><script language="javascript">for (i=1;i<10;i++){document.write("<option>1111111111000"+i+"</option>")}for (i=10;i<100;i++){document.write("<option>111111111100"+i+"</option>")}for (i=100;i<1000;i++){document.write("<option>11111111110"+i+"</option>")}</script></select></form></body></html> EXTjs的ComboBox问题 求一正则表达式,在字符串匹配后面加上一段字符串 如何定义一个二维数组 javascript控制div XHTML不提倡使用iframe, 那用什么来代替? 如何返回一个引用值?像c++的语法那样。 关于动态判断的问题,望高手解决! 多选列表框问题 怎么实现D:/的文件目录列表? 关于历史页面的问题!!! 求教给变量赋值问题!!! 请问怎样把网页做成一断代码提供给别人调用?在线等
就是轮流选择以所输字符打头的选项.
现在楼主的要求似乎与这个大多数人已经认同的情形相悖!不可以因为某个使用者的想法
破坏其他更多使用者的习惯
想输入一个1000-9999的数值
却采用下框(而不用input)
真的有点夸张啊!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
x="";
str="1111111111";
function aa()
{ if (event.keyCode==27){
x="";
document.f1.s1.options[0].text="";
f1.s1.options[0].selected=true;
}
if (isNaN(parseInt(String.fromCharCode(event.keyCode)))==false){
if (x.length>=14){
x=String.fromCharCode(event.keyCode);
event.returnValue = false;}
else {
x=x+String.fromCharCode(event.keyCode);
event.returnValue = false;}
}
if (x.length<=str.length){
if(x==str.slice(0,x.length)){
document.f1.s1.options[0].text=x;}}
else{document.f1.s1.options[0].text=x;}
x=f1.s1.options[0].text;
if (x.length==14){
for (n=1;n<f1.s1.length;n++){
if (f1.s1.options[n].text==x){
f1.s1.options[n].selected=true;
document.f1.s1.options[0].text="";}
}
if (f1.s1.options[0].selected==true){
alert("输入错误!");
document.f1.s1.options[0].text="";}
}
}
</script>
<body onLoad="f1.s1.focus();">
<form name="f1">
<select name="s1" onkeydown="aa();">
<option selected></option>
<script language="javascript">
for (i=1;i<10;i++){
document.write("<option>1111111111000"+i+"</option>")}
for (i=10;i<100;i++){
document.write("<option>111111111100"+i+"</option>")}
for (i=100;i<1000;i++){
document.write("<option>11111111110"+i+"</option>")}
</script>
</select>
</form>
</body>
</html>