补充一下楼上的 <table> <tr> <td><input type="text" name=""></td> <td><input type="text" name=""></td> <td><a href="#" tabIndex="-1">oo</a></td> </tr> <tr> <td><input type="text" name=""></td> <td><input type="text" name=""></td> <td><a href="#" tabIndex="-1">00</a></td> </tr> </table>tabIndex--------------------------------------------------------------------------------DescriptionSets the tab index for the object. Syntax object.tabIndex[ = tabIndex] ResTab selection order is determined by the value of tabIndex as follows: All elements with tabIndex > 0 are selected in increasing tab index order, or in source order for duplicate tab index values. All elements with tabIndex = 0, or without tabIndex set, are selected next, in source order if more than one. Elements with tabIndex = -1 are omitted from tabbing order. This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies ToA, APPLET, AREA, BODY, BUTTON, DIV, EMBED, HR, IFRAME, IMG, INPUT, MARQUEE, OBJECT, SELECT, TABLE, TEXTAREA
function regInput(obj, reg, inputStr) {
var docSel = document.selection.createRange()
if (docSel.parentElement().tagName != "INPUT") return false
oSel = docSel.duplicate()
oSel.text = ""
var srcRange = obj.createTextRange()
oSel.setEndPoint("StartToStart", srcRange)
var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
return reg.test(str)
}如下使用:
<input name="rDoc_recCount" type="text" class="input2" onkeypress = "return regInput(this,/^[0-9]*$/,String.fromCharCode(event.keyCode))" onpaste = "return regInput(this,/^[0-9]*$/, window.clipboardData.getData('Text'))" ondrop = "return regInput(this,/^[0-9]*$/,event.dataTransfer.getData('Text'))" style="ime-mode:Disabled">
<SCRIPT LANGUAGE="JavaScript">
//<!--
function onlynumber(str)//判断是否只是数字
{
var i,strlength,tempchar;
strlength=str.length;
for(i=0;i<strlength;i++)
{
tempchar=str.substring(i,i+1);
if(!(tempchar==0||tempchar==1||tempchar==2||tempchar==3||tempchar==4
||tempchar==5||tempchar==6||tempchar==7||tempchar==8||tempchar==9))
{
alert('只能输入数字');
str="1";
break;
}
}
return str;
}
//-->
+++++
不想把部分信息提交,可以用楼上的这位大哥的方法
document.form1.text1.disabled = true;
}onkeypress
onblur
能不能条转到下一个输入
<html>
<head>
<title> New Document </title>
</head>
<script language="JavaScript">
<!--
window.document.attachEvent("onkeydown" , function(){
if(window.event.keyCode==13){
window.event.keyCode = 9;
}
});
//-->
</script>
<body>
<table>
<tr>
<td><input type="text" name=""></td>
<td><input type="text" name=""></td>
</tr>
<tr>
<td><input type="text" name=""></td>
<td><input type="text" name=""></td>
</tr>
</table>
</body>
</html>
<table>
<tr>
<td><input type="text" name=""></td>
<td><input type="text" name=""></td>
<td><a href="#" tabIndex="-1">oo</a></td>
</tr>
<tr>
<td><input type="text" name=""></td>
<td><input type="text" name=""></td>
<td><a href="#" tabIndex="-1">00</a></td>
</tr>
</table>tabIndex--------------------------------------------------------------------------------DescriptionSets the tab index for the object. Syntax
object.tabIndex[ = tabIndex]
ResTab selection order is determined by the value of tabIndex as follows: All elements with tabIndex > 0 are selected in increasing tab index order, or in source order for duplicate tab index values.
All elements with tabIndex = 0, or without tabIndex set, are selected next, in source order if more than one.
Elements with tabIndex = -1 are omitted from tabbing order.
This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies ToA, APPLET, AREA, BODY, BUTTON, DIV, EMBED, HR, IFRAME, IMG, INPUT, MARQUEE, OBJECT, SELECT, TABLE, TEXTAREA