日期:2014-05-16  浏览次数:20471 次

125个常用javascript语句.

125个常用javascript语句.
2011年07月24日
  107个常用javascript语句
  -7.焦点 .focus();
  -6.捉拿对象通用措施 function $(obj) {return document.getElementByIdx_x(obj);}
  
  -5.字符串赋值数组var array=new Array();
  array=tdrczpdata.split('');
  -4;Request[""];
  -3.常用iframe
  -2.常用
  //讹谬提醒
  function AlertErrorMeg(meg){
  alert(meg);
  }
  //提醒转向
  function AlertRedirect(meg,url){
  alert(meg);
  window.location.assign(url);
  }
  -1.动态绑定措施$('JournalList1').attachEvent("onchange", onchangList);
  0.数组赋值给下拉菜单state_selectxh.xhnight.com.options.length = state_select_num ;
  for( i=1 ; ihtml->(head,body)
  4.一个博览器窗口中的DOM次序是:window->(navigator,screen,history,location,documen t)
  5.获得表单中元素的名目和值:document.getElementByIdx_x("表单中元素的ID号").name(或value)
  6.一个小写转大写的JS: document.getElementByIdx_x("output").value = document.getElementByIdx_x("input").value.toUpperC ase();
  7.JS中的值种类:String,Number,Boolean,Null,Object,Function
  8.JS中的字符型转换成数值型:parseInt(),parseFloat()
  9.JS中的数字转换成字符型:(""+变量) var a=2;var b=""+a;
  10.JS中的取字符串长度是:(length)
  11.JS中的字符与字符相连接利用号.
  12.JS中的比拟垄断符有:==等于,!=不等于,>,>=,
  49.引用一个文件式的JS:
  50.指定在不扶持脚本的博览器揭示的HTML:
  51.当超链和onCLICK事件都有时,则老版本的博览器转向a.html,否则转向b.html.例:dfsadf
  52.JS的内建对象
  有:Array,Boolean,Date,Error,EvalError,Function,Math, Number,Object,RangeError,ReferenceError,RegExp,Stri ng,SyntaxError,TypeErr
  or,URIError
  53hs.hsjxt.com.JS中的换行:/n
  54.窗口全屏大小:function fullScreen(){ this.moveTo
  (0,0);this.outerWidth=screen.availWidth;this.outer Height=screen.availHeight;}window.maximize=fullScre en;
  55.JS中的all代表其基层的全副元素
  56.JS中的焦点次序:document.getElementByIdx_x("表单元素").tabIndex = 1
  57.innerHTML的值是表单元素的值:如"how are you",则innerHTML的值即便:how are you
  58.innerTEXT的值和上面的一样,只不过不会把这种标记揭示出来.
  59.contentEditable可设置元素是否可被修正,isContentEditable归来是否可修正的状态.
  60.isDisabled推断是否为遏止状态.disabled设置遏止状态
  61.length获得长度,归来整型数值
  62.addBehavior()是一种JS调用的表面函数文件其伸展名为.htc
  63.window.focus()使目前的窗口在所有窗口之前.
  64.blur()指错过焦点.与FOCUS()相反.
  65.select()指元素为选中状态.
  66.遏止用户对文本框中输入文本:onfocus="this.blur()"
  67.取出该元素在版面中揭示的数量:document.all.tags("div(或其它HTML标记符)").length
  68.JS中分为两种窗体输出:模态和非模态.window.showModaldialog(),window.showModeless()
  69.状态栏文字的设置:window.status='文字',默认的状态栏文字设置:window.defaultStatus = '文字.';
  70.增加到珍藏夹:external.AddFavorite("http://om";,"jaskdlf");
  71.JS中遭到脚本讹谬时不做任何垄断:window.onerror = doNothing; 指定讹谬句柄的语法为:window.onerror = handleError;
  72.JS中指定目前敞开窗口的父窗口:window.opener,扶持opener.opener...的多重继续.
  73.JS中的immolation指的是目前的窗口
  74.JS中状态栏揭示内容:window.status="内容"
  75.JS中的top指的是框架凑近最顶层的框架
  76.JS中关闭目前的窗口:window.close();
  77.JS中提出是否确认的框:if(confirm("Are you sure?")){alert("ok");}else{alert("Not Ok");}
  78.JS中的窗口重定向:window.navigate("http://om.cn";);
  79.JS中的打印:window.print()
  80.JS中的提醒输入框:window.prompt("message","defaultReply");
  81.JS中的窗口滚动条:window.scroll(x,y)
  82.JS中的窗口滚动到位置:window.scrollby
  83.JS中设置工夫间隔:setInterval("expr",msecDelay)或setInterval(funcRef,msecDelay)或setTimeout
  84.JS中的模态揭示在IE4 行,在NN中不行:showModalDialog("URL"[,arguments][,features]);
  85.JS中的退出之前利用的句柄:function verifyClose(){event.returnValue="we really like you and hope you will stay longer.";}}
  window.=verifyClose;
  86.当窗体第顺次调用时利用的文件句柄:onload()
  87.当窗体关闭时调用的文件句柄:onunload()
  88.window.location的属性: protocol(http:),hostname(om),port(80),host(om:80), pathname
  ("/a/a.html"),hash("#giantGizmo",指跳转到相应的锚记),href(全副的消息)
  89.window.location.reload()刷新目前版面.
  90.window.history.back()归来上一页,window.history.forward()归来下一页,window.history.go(归来第几页,也能够利用拜会过的URL)
  91.document.write()不换行的输出,docum