浏览器输入
来源:互联网 发布:二维旋转变换矩阵 编辑:程序博客网 时间:2024/06/04 18:12
<html>
<head>
<script type="text/javascript">
var ListUtil ={};
ListUtil.remove = function(oListbox,iIndex)
{
oListbox.remove(iIndex);
};
ListUtil.clear = function(oListbox)
{
for(var i=oListbox.options.length-1;i>=0;i--)
{
ListUtil.remove(oListbox,i);
}
};
ListUtil.add = function(oListbox,sName,sValue)
{
var oOption = document.createElement("option");
oOption.appendChild(document.createTextNode(sName));
if(arguments.length ==3)
{
oOption.setAttribute("value",sValue);
};
oListbox.appendChild(oOption);
}
</script>
<script type="text/javascript">
var TextUtil = {};
TextUtil.autoSuggestMatch = function(sText,arrValues)
{
var arrResult =[];
if(sText != "")
{
for(var i=0;i<arrValues.length;i++)
{
if(arrValues[i].indexOf(sText) ==0)
{
arrResult.push(arrValues[i]);
}
}
}
return arrResult;
};
TextUtil.autoSuggest = function(oTextbox,arrValues,sListboxId)
{
var oListbox = document.getElementById(sListboxId);
ListUtil.clear(oListbox);
var arrMatches = TextUtil.autoSuggestMatch(oTextbox.value,arrValues);
for(var i=0;i< arrMatches.length;i++)
{
ListUtil.add(oListbox,arrMatches[i]);
} ;
oListbox.style.visibility = "visible";
}
</script>
<script type="text/javascript">
var arrColors =["red","red1","yellow","gray","white"];
arrColors.sort();
function setText(oListbox,sTextboxId)
{
var oTextbox = document.getElementById(sTextboxId);
if (oListbox.selectedIndex >-1)
{
oTextbox.value =
oListbox.options[oListbox.selectedIndex].text;
};
oListbox.style.visibility = "hidden";
}
</script>
</head>
<body>
<p> Type in a color in lowercase:<br/>
<input type="text" value="" id="txtColor"
onkeyup="TextUtil.autoSuggest(this,arrColors,'lstColors')"></input><br/>
<select id="lstColors" size="5" style="width:200px;visibility:hidden;"
onclick = "setText(this,'txtColor')"></select>
</p>
</body>
</html>
- 浏览器输入
- 浏览器安全输入控件
- 浏览器只允许输入数字
- webdriver打开浏览器输入selenium
- 浏览器地址栏输入URL,回车......
- 浏览器光标闪烁无法输入
- 微信端和手机qq浏览器输入框不能输入汉字
- 当你输入在浏览器输入网址发生了什么
- 浏览器总是提示验证码输入错误
- 用ComboBox制作浏览器输入框效果
- 清除浏览器自动记录之前输入的值
- IE浏览器无法正常输入问题
- IE浏览器不能登录、清除输入信息
- js获取浏览器输入框地址
- 浏览器输入URL访问服务器过程
- IE浏览器地址栏输入中文乱码问题
- 浏览器输入网址后台怎么运行
- 浏览器输入网址之后加载原理
- 手把手教你写S12XS128程序(8)--PWM 应用实例
- 邮件服务器(一)
- RTP/RTCP/RTSP协议
- bbb22
- C语言:内存字节对齐详解[转载]
- 浏览器输入
- VC++创建个性的对话框之MFC篇(转)
- 设计模式-----开放--封闭原则
- dl dt 和 dd
- 最近有点累
- 本站Qt开源项目cutereader启动~
- 调用豆瓣的接口根据ISBN获取书籍信息
- Maven常见问题
- 令人遗憾的中国达人秀