4、用focus即可
5、见 http://expert.csdn.net/Expert/TopicView1.asp?id=2377985
5、见 http://expert.csdn.net/Expert/TopicView1.asp?id=2377985
解决方案 »
- JS循环读取XML
- js设置iframe的src ,在调用print()问题。
- <input type="button" value="button" onclick="document.write('<div>1</div>')">小问题
- 如何使表格打印时不被分离
- 版主,帮我解决一下这个问题,谢谢啦
- javascript中,extend和prototype分別有什么用?
- 如何把字符串用分隔符存到jquery数组里面
- 时间运行错误问题
- 一直没有系统的学过JS,想找本书看看........谢谢大家...呵呵.......
- 大家看看这段代码~很简单!
- 下拉列表与输入文本框联动问题,单选按钮与行或列联动问题,单选按钮与下拉列表框连动问题(在线等待)
- 框架之间的刷新问题!
<tr>
<td><input></td>
<td><input></td>
<td><input></td>
</tr>
</table><script id="server" src="" onreadystatechange="server_return()"></script><script>
function keycheck() {
el = event.srcElement;
if(event.keyCode == 13) {
if(el.parentElement.cellIndex == 0)
server.src = "服务器程序?k="+el.value; // 见要求
}
}
server_mode = "";
function server_return() {
if(server_mode == "") return;
el.parentElement.parentElement.cells[1].children[0].value = server_mode;
el.parentElement.parentElement.cells[2].children[0].focus(); row = tab.lastChild.appendChild(tab.rows(tab.rows.length-1).cloneNode(true))
for(i=0;i<row.cells.length;i++)
row.cells[i].children[0].value = "";
}
</script>要求:
服务器程序可以是任意语言,只要能做到:
接受url参数,处理完毕后输出一行
server_mode = "这里是查询结果";
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>GetInfoFromDataBase</title>
</head>
<script>function addFun()//JK
{
var newRow = forAddTable.rows[0].cloneNode(true);
var desRow = scoreTable.rows[scoreTable.rows.length-1];
desRow.parentElement.insertBefore(newRow,desRow);
scoreTable.rows[scoreTable.rows.length-2].all.studentNo.focus();
}
function deleteFun(deleteButton)//JK
{ var documentCheckBox=document.getElementsByName("scoreID");
if (confirm("Are you sure to delete?"))
{
scoreTable.deleteRow(deleteButton.parentElement.parentElement.rowIndex);
}}function getTheStudentNameFun(studentNoInput)
{
var a=showModalDialog("GetStudentByNo.jsp?studentNo="+studentNoInput.value,"","status:no;resizable:no;help:no;dialogHeight:10px;dialogWidth:10px;");
//if (a!=null)
{
studentNoInput.parentElement.parentElement.all.studentName.value=a;
}
}function keyDownControl()
{
k=event.keyCode;
if(k==13)
{
event.keyCode=9;
}}
</script>
<body><table width="100%" cellspacing="1" cellpadding="2" align="left" id="scoreTable"><tr >
<td width=1 > </td>
<td >No</td>
<td >Name</td>
<td >Score</td>
</tr><tr >
<td width=1 ><input type=button value=Delete onclick="deleteFun(this);" ></td>
<td ><input name=studentNo onchange="getTheStudentNameFun(this);return ;" onkeydown="keyDownControl();"></td>
<td ><input name=studentName disabled></td>
<td ><input name=studentScore onkeydown="keyDownControl();"></td>
</tr>
<tr><td><input type=button value=Add onclick="addFun();" ></td></tr>
</table>
<table id=forAddTable disabled style="display:none">
<tr >
<td width=1 ><input type=button value=Delete onclick="deleteFun(this);" ></td>
<td ><input name=studentNo onchange="getTheStudentNameFun(this);return ;" onkeydown="keyDownControl();"></td>
<td ><input name=studentName disabled></td>
<td ><input name=studentScore onkeydown="keyDownControl();"></td>
</tr>
</table>
-------------------------------------
GetStudentByNo.jsp:
<%String theStudentName="独孤求败";%><
script language=javascript> window.returnValue='<%=theStudentName%>';
window.close();
</script></body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>GetInfoFromDataBase</title>
</head>
<script>function addFun()//JK
{
var newRow = forAddTable.rows[0].cloneNode(true);
var desRow = scoreTable.rows[scoreTable.rows.length-1];
desRow.parentElement.insertBefore(newRow,desRow);
scoreTable.rows[scoreTable.rows.length-2].all.studentNo.focus();
}
function deleteFun(deleteButton)//JK
{ var documentCheckBox=document.getElementsByName("scoreID");
if (confirm("Are you sure to delete?"))
{
scoreTable.deleteRow(deleteButton.parentElement.parentElement.rowIndex);
}}function getTheStudentNameFun(studentNoInput)
{
var a=showModalDialog("GetStudentByNo.jsp?studentNo="+studentNoInput.value,"","status:no;resizable:no;help:no;dialogHeight:10px;dialogWidth:10px;");
//if (a!=null)
{
studentNoInput.parentElement.parentElement.all.studentName.value=a;
}
}function keyDownControl()
{
k=event.keyCode;
if(k==13)
{
event.keyCode=9;
}}
</script>
<body><table width="100%" cellspacing="1" cellpadding="2" align="left" id="scoreTable"><tr >
<td width=1 > </td>
<td >No</td>
<td >Name</td>
<td >Score</td>
</tr><tr >
<td width=1 ><input type=button value=Delete onclick="deleteFun(this);" ></td>
<td ><input name=studentNo onchange="getTheStudentNameFun(this);return ;" onkeydown="keyDownControl();"></td>
<td ><input name=studentName disabled></td>
<td ><input name=studentScore onkeydown="keyDownControl();"></td>
</tr>
<tr><td><input type=button value=Add onclick="addFun();" ></td></tr>
</table>
<table id=forAddTable disabled style="display:none">
<tr >
<td width=1 ><input type=button value=Delete onclick="deleteFun(this);" ></td>
<td ><input name=studentNo onchange="getTheStudentNameFun(this);return ;" onkeydown="keyDownControl();"></td>
<td ><input name=studentName disabled></td>
<td ><input name=studentScore onkeydown="keyDownControl();"></td>
</tr>
</table></body></html>
-------------------------------------
GetStudentByNo.jsp:
<%String theStudentName="独孤求败";%><
script language=javascript> window.returnValue='<%=theStudentName%>';
window.close();
</script>