首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

兑现表单回车功能呢

2012-10-10 
实现表单回车功能呢!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//ENHTML HEADTITLE

实现表单回车功能呢

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD>  <TITLE> New Document </TITLE>  <META NAME="Generator" CONTENT="EditPlus">  <META NAME="Author" CONTENT="">  <META NAME="Keywords" CONTENT="">  <META NAME="Description" CONTENT="">  <script type="text/javascript">    $id = function (name){ return document.getElementById(name); } $name = function (name){ return document.getElementsByName(name); }     function checkType(oType){ var _initArr = new Array("text","password","checkbox","select-one","radio");for(var i = 0 ; i < _initArr.length ; i++){if(_initArr[i] == oType){return false ;}}return true ;}/*    * 使页面上的对象Enter执行TAB,参数为范围对象的name/ID    */ function tabEnterJs(_formName){ var form  = $id(_formName) ;for(var i=0;i<form.length;i++){   var _type = form.elements[i].type; //if(checkType(_type)){    //continue;    //}    form.elements[i].oldOnkeydown = form.elements[i].onkeydown;    form.elements[i].onkeydown=function(){    if(this.oldOnkeydown){    var okd = this.oldOnkeydown();    if(okd==false){    return false;    }    }    if(event.keyCode==13){    event.keyCode=9;    }    } }   } </script>  </HEAD> <BODY><form id="form1"><input type="text" > <input type="password" ><input type="text" ><input type="checkbox" ><input type="radio" name="rad" ><input type="text" ><select><option>请选择</option><option>111</option><option>333</option><option>222</option></select><input type="text" ><input type="button" value="普通按钮" ><input type="reset" value="重置" ><input type="submit" value="确定" ></form><br><form id="form2"><input type="text" >  <input type="password" ><input type="text" ><input type="checkbox" ><input type="radio" ><input type="text" ><select><option>请选择</option><option>111</option><option>333</option><option>222</option></select><input type="text" ></form><SCRIPT LANGUAGE="JavaScript"><!--tabEnterJs("form1");//--></SCRIPT> </BODY></HTML>

热点排行