<style>
td{
background-color:#FFF;
}
</style><table cellspacing="1" cellpadding="1" bgcolor="black" width="100%" height="50%" id="table1">
<tr>
<td><input value="1" /></td>
<td><input value="2" /></td>
<td><img src="<%=request.getContextPath()%>/images/start-1.gif" width="106" height="20" ></td>
</tr>
</table><script>
document.getElementById("table1").onkeydown = function(e){
e = window.event || e;
var obj = e.srcElement || e.target; // 上
if(e.keyCode == 38){try{
var index = obj.parentNode.cellIndex;
var tr = obj.parentNode.parentNode.previousSibling;// 得到当前控件上一个 tr
tr = tr.nodeType == 3 ? tr.previousSibling : tr;// 为了兼容 FF
if(tr != null && tr.tagName != null && /^tr$/i.test(tr.tagName)){
if(tr.cells[index] != null){
tr.cells[index].childNodes[0].focus();
}
}{// tr 不存在,或不是 tr
return false;
}}catch(ex){alert(ex.message)}
}怎么让txt文当档里的焦点移出来到图片上,进行提交~~~~~~~~~~~~~~~
在线等待!!!!!!!!
<img id=cjw src=............>js:
if(e.keyCode == 38){
var o=docuemnt.getElementById("cjw");
o.focus();//焦点
// o.submit();//提交
}
<html>
<head>
<style>
td{background-color:#FFF;}
</style>
<script>
function cjwfn(e){
e = window.event || e;
if(e.keyCode == 38){// 上
var o=docuemnt.getElementById("cjw");
o.focus();//焦点
//o.submit();//提交
}
/*
try{
var index = obj.parentNode.cellIndex;
var tr = obj.parentNode.parentNode.previousSibling;// 得到当前控件上一个 tr
tr = tr.nodeType == 3 ? tr.previousSibling : tr;// 为了兼容 FF
if(tr != null && tr.tagName != null && /^tr$/i.test(tr.tagName)){
if(tr.cells[index] != null){
tr.cells[index].childNodes[0].focus();
}
}
}}catch(ex){alert(ex.message)}
*/
}
</head>
<body>
<table onkeypress="cjwfn(event);" cellspacing="1" cellpadding="1" bgcolor="black" width="100%" height="50%" id="table1">
<tr>
<td><input value="1" /> </td>
<td><input value="2" /> </td>
<td><img id=cjw src=" <%=request.getContextPath()%>/images/start-1.gif" width="106" height="20" > </td>
</tr>
</table>
</body>
</html>