xxtianxiaxing 发表于 2013-2-7 18:15:50

js 常用方法

//------------------字符串的长度验证function bytelength(szString) {return szString.replace(new RegExp("[^\x00-\xff]","g")," ").length;}//------------------操作span的隐藏与显示document.getElementById("isActiveShow"+id).style.display = "none";document.getElementById("isActivedisplay"+id).style.display = "";//------------------JavaScript实现 回车 执行 按钮<script type="text/javascript">function document.onkeydown()                //网页内按下回车触发{      if(event.keyCode==13)    //回车键监听      {          if(document.activeElement.id=="rightform:textfield"){ //判断只有在输入框获取焦点的时候,方法执行               document.getElementById("rightform:button17").click();   //此id为jsf框架下的id,html正常写就行                return false;                        }      }}</script>//-------------------添加收藏<a href="javascript:window.external.AddFavorite(window.document.location,window.document.title)">添加收藏夹</a></span>//------------------- 通用自动加载//addCountry为方法名if (document.all) { //iewindow.attachEvent("onload", addCountry);} else { //ffwindow.addEventListener("load", addCountry, false);}
页: [1]
查看完整版本: js 常用方法