就是说像google中那样,能匹配搜索的字符用小键盘上的上、下键移动付给文本输入框
解决方案 »
- 请帮助 js实现鼠标移动到文字显示图片
- 请教JS中函数参数传递问题
- jquery级联问题 急哦!没分了请大家帮忙 以后补上
- [高分求助] 求一套较复杂的页面操控程序,参与讨论的内容有借鉴意义,则都有分数相赠,谢谢。
- 求"设置IE的页面设置的上下左右页边距脚本"
- JS中怎么加入ASP代码?
- 小问题,但却有点难度
- 用链接下载的一个简单问题。在线等。。。。。。。。。。
- 高手,请教一下!怎样用JS代码来实现XML文档修改后的保存呢?
- js 中,我如果让一个按钮捆绑100个按钮,每个按钮都有自己的事件,那100个事件会百分之百执行成功吗?
- 简单问题_和onclick与链接有关
- javascript取得焦点和失去焦点
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Bug</title>
<script>
var tdIndex = 1;
function change(){
if(event.keyCode==40){
tdIndex+=1; eval("document.all.td"+tdIndex+".style.backgroundColor='#3366aa'");
document.all.txt.value = eval("document.all.td"+tdIndex+".innerText");
}//down }
</script>
</head>
<body onkeydown="change()" >
<table border='1' bordercolor="#FFFFFF">
<tr>
<td id="td1">one</td>
</tr>
<tr>
<td id="td2">two</td>
</tr>
<tr>
<td id="td3">three</td>
</tr>
<tr>
<td id="td4">four</td>
</tr>
<tr>
<td id="td5">five</td>
</tr>
</table>
<input type="text" value="" id="txt">
</body>
</html>没时间了 做了一下 你参考完成以后的吧
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<script language="javascript">
window.document.onkeydown=test;
function $(o)
{
return document.getElementById(o);
}
var currentFocus={y:0};
function test()
{
if(event.keyCode==38 && currentFocus.y>0)
{
currentFocus.y--;
}
if(event.keyCode==40 && currentFocus.y<$("table1").rows.length-1)
{
currentFocus.y++;
}
for(i=0;i<$("table1").rows.length;i++)
{
var tempBgColor=$("table1").rows[i].cells[0].bgColor
if(i==currentFocus.y)
{
$("table1").rows[i].cells[0].bgColor="#00ff00";
}
else
{
$("table1").rows[i].cells[0].bgColor="";
}
}
$("input1").value=$("table1").rows[currentFocus.y].cells[0].innerText; }
</script>
</head>
<body>
<table border="1" width="100%" id="table1" height="320">
<tr>
<td style="width:33%;"> 123123</td>
<tr>
<td style="width:33%;"> asdfasdfa</td>
</tr>
<tr>
<td style="width:33%;"> baa2424234234</td>
</tr>
</table>
<input type="text" id="input1">
</body>
</html>
是这种效果吗?