87,904
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script type="text/jscript">
var codeList={1:"A",
2:"B",
3:"C"};
window.onload=function(){
setBound();
}
function setBound(){
var input=document.getElementsByTagName("input");
for(var i=0;i<input.length;i++){
if(i%4==0){
input[i].onclick=function(){};
input[i].onblur=function(){
if(this.value=="")return;
this.parentNode.parentNode.childNodes[1].childNodes[0].value=codeList[this.value];
this.parentNode.parentNode.childNodes[3].childNodes[0].focus();
};
}else if(i%4==3){
//check ...insert new row...
}
}
}
</script>
</head>
<body>
<table border=1>
<tr><th>code</th><th>name</th><th>place</th><th>account</th></tr>
<tr><td><input></td><td><input></td><td><input></td><td><input></td></tr>
</table>
</body>
</html>