<script language="javascript">
function focusNext(){
if(window.event.keyCode!=13)
return;
//终止冒泡处理
event.cancelBubble=true;
event.keyCode='0';
//只有在input中输入的回车才会处理
if(event.srcElement.tagName.toLowerCase() != "input")
return ;
var fieldObject = event.srcElement;
//得到所有表单对象
//concat连接后数组竟然是二维,吐血,只好自己写了 :(
var eles = new Array();
var forms = document.forms;
for(var i=0; i<forms.length; i++)
for(var j=0; j<forms[i].elements.length; j++)
eles[eles.length] = forms[i].elements[j];
for(var i=0; i<eles.length; i++)
//找到发出事件的表单对象
if(eles[i] == fieldObject)
for (var j=i+1; j<eles.length; j++){
//找到下一个可用input,focus
if(eles[j].tagName.toLowerCase() != "input")
continue;
if (eles[j].type != 'hidden' && eles[j].disabled != true && eles[j].readOnly != true){
eles[j].focus();
return ;
}
}
}
//去掉空格
function Trim(str){
if(str.charAt(0) == " "){
str = str.slice(1);
str = Trim(str);
}
return str;
}
//判断输入邮编是否是数字
function isNumber(pObj,errMsg){
var obj = eval(pObj);
strRef = "1234567890";
if(obj.value.length!=6){ alert("输入邮编错误,请重新输入");obj.focus();return false;}
if(!isEmpty(pObj,errMsg))return false;
for (i=0;i<obj.value.length;i++) {
tempChar= obj.value.substring(i,i+1);
if (strRef.indexOf(tempChar,0)==-1) {
if (errMsg == null || errMsg =="")
alert("输入邮编错误,请重新输入");
else
alert(errMsg);
if(obj.type=="text")
obj.focus();
return false;
}
}
return true;
}
//判断输入是否为空
function isEmpty(pObj,errMsg){
var obj = eval(pObj);
if( obj == null || Trim(obj.value) == ""){
if (errMsg == null || errMsg =="")
alert("输入为空!");
else
alert(errMsg);
obj.focus();
return false;
}
return true;
}
//检查表单的各项输入
function checked(){
if (!isEmpty(hk.hk_rece_yb,'请输入收卡人邮编')) return false;
document.hk.action="XX.asp"
document.hk.submit();
}
</script>
function focusNext(){
if(window.event.keyCode!=13)
return;
//终止冒泡处理
event.cancelBubble=true;
event.keyCode='0';
//只有在input中输入的回车才会处理
if(event.srcElement.tagName.toLowerCase() != "input")
return ;
var fieldObject = event.srcElement;
//得到所有表单对象
//concat连接后数组竟然是二维,吐血,只好自己写了 :(
var eles = new Array();
var forms = document.forms;
for(var i=0; i<forms.length; i++)
for(var j=0; j<forms[i].elements.length; j++)
eles[eles.length] = forms[i].elements[j];
for(var i=0; i<eles.length; i++)
//找到发出事件的表单对象
if(eles[i] == fieldObject)
for (var j=i+1; j<eles.length; j++){
//找到下一个可用input,focus
if(eles[j].tagName.toLowerCase() != "input")
continue;
if (eles[j].type != 'hidden' && eles[j].disabled != true && eles[j].readOnly != true){
eles[j].focus();
return ;
}
}
}
//去掉空格
function Trim(str){
if(str.charAt(0) == " "){
str = str.slice(1);
str = Trim(str);
}
return str;
}
//判断输入邮编是否是数字
function isNumber(pObj,errMsg){
var obj = eval(pObj);
strRef = "1234567890";
if(obj.value.length!=6){ alert("输入邮编错误,请重新输入");obj.focus();return false;}
if(!isEmpty(pObj,errMsg))return false;
for (i=0;i<obj.value.length;i++) {
tempChar= obj.value.substring(i,i+1);
if (strRef.indexOf(tempChar,0)==-1) {
if (errMsg == null || errMsg =="")
alert("输入邮编错误,请重新输入");
else
alert(errMsg);
if(obj.type=="text")
obj.focus();
return false;
}
}
return true;
}
//判断输入是否为空
function isEmpty(pObj,errMsg){
var obj = eval(pObj);
if( obj == null || Trim(obj.value) == ""){
if (errMsg == null || errMsg =="")
alert("输入为空!");
else
alert(errMsg);
obj.focus();
return false;
}
return true;
}
//检查表单的各项输入
function checked(){
if (!isEmpty(hk.hk_rece_yb,'请输入收卡人邮编')) return false;
document.hk.action="XX.asp"
document.hk.submit();
}
</script>