ECMA ÍƳö JavaScript 5
ECMA ±¾ÖÜÍƳöÁË JavaScript 5£¨PDF£©£¬³ýÁËÔöÇ¿»ù´¡º¯Êý¿âÖ®Í⣬»¹ÒýÈëÁËÑϸñÔËÐÐʱģʽ£¨Strict Runtime Modes£©ÒÔ±ÜÃâ´úÂëÖеij£¼û´íÎó¡£ECMA ECMAScript 4 µÄŬÁ¦ÔøÒÔʧ°Ü¸æÖÕ£¬ECMA ÉõÖÁûÓз¢²¼ ECMAScript 4 ϸÔò¡£
¹ýÈ¥¼¸Ä꣬ÖîÈç Nitro£¬TraceMonkey Ò»ÀàµÄ JavaScript ÒýÇ淢չѸÃÍ£¬JavaScript ³ÉÁË Google Wave Ò»ÀàÓ¦ÓõÄг衣¼øÓÚ´Ë£¬ECMAScript 5 ÔÚ¼æÈÝÄ¿Ç°¹ã·ºÊ¹ÓÃµÄ ECMAScript 3 µÄͬʱ£¬ÌṩÁËÑϸñģʽ£¬ÒÔ·ÀÖ¹¿ª·¢Õß·¸´í¡£
Ñϸñģʽ
Ñϸñģʽ¿ÉÓÃÒÔÏÂÓï¾äÉùÃ÷£º
"use strict;"
¸ÃÓï¾ä¶ÔÒÔÍùµÄ´úÂëûÓÐÓ°Ï죬µ« JavaScript 5 µÄÐÂÔËÐÐʱ»á½øÈëÑϸñģʽ£¬ÑϸñģʽÖ÷Òª°üº¬ÒÔϸı䣺
±äÁ¿±ØÐëÉùÃ÷ºó²Å¿ÉÒÔʹÓÃ
Eval ³ÉΪ±£Áô´Ê£¬Í¬Ê±£¬²»¿ÉÒÔÔÙʹÓà Eval ÉùÃ÷±äÁ¿£¬Èç eval("var i=3"); print(i); Ö®ÀàµÄÓï¾ä»á±¨´í
8½øÖÆÊý×Ö±íʾ±»½ûÖ¹£¬ 010
´ú±í 10 ¶ø²»ÊÇ 8
²ÎÊýÖв»ÔÙÔÊÐíʹÓà delete
with Óï¾äÔøÊÇÍò´íÖ®Ô´£¬ÏÖ±»½ûÓá£
º¯ÊýÖв»¿ÉÒÔÔÙ³öÏÖÖØÃû²ÎÊý¡£
¶ÔÏóÖв»¿ÉÒÔÔÙ³öÏÖÖØÃûÊôÐÔ¡£
arguments
ºÍ caller
±äÁ¿ÏÖÔÚÊÇ immutable ±äÁ¿
·ÃÎÊÈ«¾Ö¶ÔÏó»á±¨´í¡£
º¯ÊýÀ©Õ¹
ÔÚ»ù±¾º¯Êý¿â£¬Ò²ÓÐһЩ±ä»¯:
Date ÏÖÔÚÖ§³Ö ISO8601 ÈÕÆÚ¸ñʽ
String ÄÚÖÃÁË trim() ·½·¨
ÒýÈ뱸ÊÜ»¶ÓµÄ JSON ¶ÔÏó
ÄÚÖÃÁË bind ²Ù×÷
Array ¶ÔÏóÄÚÖÃÁËһЩ±ê×¼º¯Êý£¬Èç indexOf(), map(), filter(), reduce()
Object ÄÚÖÃÁËseal()
º¯Êý£¬·ÀÖ¹±»¼ÓÈëÐÂÊôÐÔ£¬Í¬Ê±ÄÚÖà freeze() º¯Êýʹ¶ÔÏó±ä³ÉÖ»¶Á״̬
Object.keys()
»áÁгö¶ÔÏóÖÐËùÓпÉÒÔö¾ÙµÄÊôÐÔ
Object.getOwnPropertyNames()
»áÁгö¶ÔÏóÖÐËùÓпÉö¾ÙÒÔ¼°²»¿Éö¾ÙµÄÊôÐÔ
Object.getPrototypeof()
·µ»Ø¸ø¶¨¶ÔÏóµÄÔÐÍ
Ïà¹ØÎĵµ£º
var Stack=function(limt_length){
this.stack=new Array();
this.limt=(limt_length)?limt_length:8;
}
Stack.prototype.push=function(o){
if(this.exist(o)){
this.remove(o);
this.stack.unshift(o);
}else{
this.stack.unshift(o);
}
while(t ......
ÒýÈëÃüÃû¿Õ¼ä֮ǰ£¬Ò»¸öÁ·¢ÈËԱͷÌÛµÄÎÊÌâ¾ÍÊÇÈçºÎ·ÀÖ¹º¯ÊýÃû/ÀàÃûºÍÆäËûÈ˵ijåÍ»£¬ÔÚÒ»¸ö¹«Ë¾ÄÚ²¿ÏîÄ¿×éÖ®¼ä¿ÉÒÔͨ¹ýÃüÃûÔ¤¶¨£¨±ÈÈç¼Óǰ׺
µÈ£©½â¾öÕâ¸öÎÊÌ⣬µ«ÊÇ°ÑÊÓÏ߷ŵ½Õû¸öÈí¼þ¿ª·¢ÁìÓò£¬ÔÚµ±½ñÐ×÷¿ª·¢Ï൱ʢÐеÄʱ´ú£¬Õâ¸öÎÊÌâÈ´ÒÀÈ»´æÔÚ¡£ÔÚʹÓöà¸öµÚÈý·½¿ò¼Ü»òÀà¿âµÄʱºò£¬ÄãΨһÄÜ×÷
µÄ¾ÍÊÇÆíµ»ËüÃǵÄÃüà ......
½ñÌìżȻ¼ä¿´µ½Ò»¶ÎJS´úÂ룺
......
<mce:script for="t" event="onclick"><!--
alert('hello');
// --></mce:script>
......
<a href="#" mce_href="#" id="t" ></a> hello </a>
.....
ÕâÊÇʲôд·¨£¿
²éÁËÏÂW3CµÄ ......
1¡¢Ö±½ÓÔÚǰ̨µ÷Óà javascript º¯Êý
ºÜ¼òµ¥,ÔÚ head ÔªËØÖ®¼ä¼ÓÈë script ÔªËØ,½« type ÔªËØÉèÖÃΪ " text/javascript "
Èç:
<head runat="server">
<mce:script type="text/javascript" ><!--
function ShowName(str)
{
alert("ÄúµÄÃû×ÖΪ:("+str+")");
}
// --></mce:script>
< ......
if (elename.equalsIgnoreCase("back") || elename.equalsIgnoreCase("1"))
return "<a href=\"javascript:window.history.back()\">ºóÍË</a>";
&nbs ......