自动匹配输入框
2008-01-16 21:44
162 查看
<html>
<head>
<title>
</title>
<style>
ul,li{margin: 0; padding: 0;width:100%;}
</style>
<script language="javascript" type="text/javascript">
function checkword()
{
var wordvalue=document.getElementById("word").value.toLowerCase();
var alltxt="admin管理员|apple苹果|all全|big大|bad坏|cut剪切|car车|daph8|eeg|egg|eat|fuck|fuck you|fix|good|hand|hidden|ill|jack|jad|kevin|long|man|number|oio|part|pp|quit|QQ|rest|reg|set|submit|time|tag|uuzo.cn|uuzo|view|windows|want|xy|xun|young|yuyu|zoo|Zzz|锋.David|David|哈哈|www.uuzo.cn|www.uuzo.com";
var alltxtpp=alltxt.toLowerCase();
var alltxt_xiang=alltxt.split("|");
var alltxt_xiang1=alltxtpp.split("|");
var inhtml="<ul>"
var isyou=0;
for (i=0;i<alltxt_xiang1.length;i++)
{
if (alltxt_xiang1[i].substr(0,wordvalue.length)==wordvalue)
{
inhtml=inhtml+"<li onclick=/"document.getElementById('word').value=this.innerHTML;document.getElementById('showmenu').style.display='none';/" onmouseover=/"this.style.backgroundColor='#666666'/" onmouseout=/"this.style.backgroundColor=''/">"+alltxt_xiang[i]+"</li>";
isyou=1;
}
}
inhtml=inhtml+"</ul>";
if (isyou==1)
{
document.getElementById("showmenu").innerHTML=inhtml;
document.getElementById("showmenu").style.display="";
}
else
{
document.getElementById("showmenu").innerHTML="";
document.getElementById("showmenu").style.display="none";
}
if (wordvalue=="")
{
document.getElementById("showmenu").innerHTML="";
document.getElementById("showmenu").style.display="none";
}
}
</script>
</head>
<body>
<input type="text" name="word" size="20" id="word" onkeyup="checkword()" style="border:1px solid #666666;width:200px;height:25px;">
<div style="position: absolute; width: 200px; height: 100px; z-index: 1; left: 10px; top: 40px;border:1px solid #666666;display:none;" id="showmenu"></div>
</body>
</html>
<head>
<title>
</title>
<style>
ul,li{margin: 0; padding: 0;width:100%;}
</style>
<script language="javascript" type="text/javascript">
function checkword()
{
var wordvalue=document.getElementById("word").value.toLowerCase();
var alltxt="admin管理员|apple苹果|all全|big大|bad坏|cut剪切|car车|daph8|eeg|egg|eat|fuck|fuck you|fix|good|hand|hidden|ill|jack|jad|kevin|long|man|number|oio|part|pp|quit|QQ|rest|reg|set|submit|time|tag|uuzo.cn|uuzo|view|windows|want|xy|xun|young|yuyu|zoo|Zzz|锋.David|David|哈哈|www.uuzo.cn|www.uuzo.com";
var alltxtpp=alltxt.toLowerCase();
var alltxt_xiang=alltxt.split("|");
var alltxt_xiang1=alltxtpp.split("|");
var inhtml="<ul>"
var isyou=0;
for (i=0;i<alltxt_xiang1.length;i++)
{
if (alltxt_xiang1[i].substr(0,wordvalue.length)==wordvalue)
{
inhtml=inhtml+"<li onclick=/"document.getElementById('word').value=this.innerHTML;document.getElementById('showmenu').style.display='none';/" onmouseover=/"this.style.backgroundColor='#666666'/" onmouseout=/"this.style.backgroundColor=''/">"+alltxt_xiang[i]+"</li>";
isyou=1;
}
}
inhtml=inhtml+"</ul>";
if (isyou==1)
{
document.getElementById("showmenu").innerHTML=inhtml;
document.getElementById("showmenu").style.display="";
}
else
{
document.getElementById("showmenu").innerHTML="";
document.getElementById("showmenu").style.display="none";
}
if (wordvalue=="")
{
document.getElementById("showmenu").innerHTML="";
document.getElementById("showmenu").style.display="none";
}
}
</script>
</head>
<body>
<input type="text" name="word" size="20" id="word" onkeyup="checkword()" style="border:1px solid #666666;width:200px;height:25px;">
<div style="position: absolute; width: 200px; height: 100px; z-index: 1; left: 10px; top: 40px;border:1px solid #666666;display:none;" id="showmenu"></div>
</body>
</html>
相关文章推荐
- 输入框自动匹配实践(java web)
- 存储过程中自动拆分输入框里的字符,然后跟表里的两三个字段去匹配
- input输入框的自动匹配(原生代码)
- JS实现仿百度输入框自动匹配功能的示例代码
- AutoCompleteTextView自动匹配输入框中的内容【转】
- 仿百度输入框自动匹配功能的JS代码
- input输入框的自动匹配(原生代码)
- 输入框自动匹配控件AutoCompleteTextView
- 基于javascript实现仿百度输入框自动匹配功能
- 基于javascript实现仿百度输入框自动匹配功能
- 前端-text输入框是下拉菜单切能自动匹配
- 仿百度输入框自动匹配功能的JS代码
- JS实现仿百度输入框自动匹配功能的示例代码
- android 输入框自动匹配-AutoCompleteTextView
- android 输入框自动匹配-AutoCompleteTextView
- 原生ajax 实现输入框模糊查询,自动匹配数据库数据
- JS实现仿百度输入框自动匹配功能的示例代码
- 自动匹配显示位置的提示框--Auto_Tooltip
- 鼠标点击时输入框内的value值自动没有
- Android输入框中提示自动输入内容