Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScriptÉè¼ÆÄ£Ê½µÄÒ»ÖÖÓÐȤµÄ·âװС¼¼ÇÉ

      javascriptÉè¼ÆÄ£Ê½µÚÒ»ÕÅÓÐÒ»¸öÓÐȤµÄʵÏּ̳еķ½·¨£¬µ±È»javascript±¾ÖÊÉÏÊÇʵÏּ̳У¬»¹²»ÊǵäÐÍÒâÒåÉϵÄ"is-a"µÄÂß¼­¼Ì³Ð»òÕß˵ÊÇÓïÒå¼Ì³Ð¡£»ù±¾µÄ·½·¨¾ÍÊÇͨ¹ýfunctionµÄprototypeÊôÐÔ¡£
Ò»£¬ºÜ¼òµ¥µÄ·½·¨
<script type="text/javascript">
<!--
var Anim = function(){};
Anim.prototype.start = function(){alert('start');};
Anim.prototype.stop = function(){alert('stop');};
var obj = new Anim();
obj.start();
obj.stop();
// -->
</script>
¶þ£¬°ÑprototypeµÄÕûÌ帳ֵ-¶ÔÏó×ÖÃæÁ¿·¨
<script type="text/javascript">
<!--
var Anim = function(){};
Anim.prototype = {
start:function(){alert('start');},
stop:function(){alert('stop');}
};
var obj = new Anim();
obj.start();
obj.stop();
// -->
</script>
 
×¢Ò⣺¶ÔprototypeÊôÐÔÕûÌ帳ֵֻÄÜÊÇÓû§×Ô¶¨ÒåµÄ¹¹Ô캯Êý£¬¶ÔjavascriptÄÚÖõĹ¹Ô캯ÊýÊDz»Äܵģ¬ÈçFunction.prototype= {};
ÊÇÎÞЧµÄ¡£
Èý£¬°ÑprototypeµÄ¸³ÖµÌáµ½Function¶ÔÏóµÄprototypeÀ´²Ù×÷¡£
<script type="text/javascript">
<!--
//¶ÔFunction¹¹Ô캯ÊýµÄprototypeÔö¼ÓÀ©Õź¯Êý
Function.prototype.extend = function(method, func){
this.prototype[method] = func;
return this; //Ö§³ÖÁ´Ê½²Ù×÷
};
//AnimÊÇеÄFunctionʵÀý£¬ËüµÄ[[prototype]]ÊÇÖ¸ÏòFunction.prototype£¬Òò´ËAnim.extend¿ÉÒÔͨ¹ýËÑË÷Ô­ÐÍÁ´
//¶øµ÷ÓÃFunction.prototype.extend·½·¨£¬¸Ã·½·¨·µ»Øthis£¬Ò²¾ÍÊǶÔÏóAnim
var Anim = function(){};
Anim.extend('start', function(){alert('start');}).extend('stop', function(){alert('stop');});
var obj = new Anim();
obj.start();
obj.stop();
// -->
</script>


Ïà¹ØÎĵµ£º

javascriptÖжÔÖÐÎĽøÐбàÂë½âÂëµÄ·½Ê½

ÖÐÎıàÂ룺
 function upload() {
  var form = document.getElementById('topic');
  if ($('uploadfile').value == "") {
   alert("ÇëÑ¡ÔñÎļþ£¡");
   return;
  } 
  $('uploadfile').value = escape($('uploadfile').value) ......

javascript µÄ scope myhere

// JavaScript ½Å±¾£¬½âÎöÐÍÓïÑÔ
//
var ABCD = function(){
var pub = {};
var pri = {};
pri.name = "myhere";
pri.age = 23;
//var ABCDE;
pub.setName = function( newName){
pri.name = newName;
};
// ÕâÀï pub.getName ±»¸³ÖµÎªÒ»¸öº¯Êý£¬¾ÍÊǶ¨ÒåÒ»¸öº¯Êý
// Õâ¸öº¯Êý²¢Ã»ÓÐÔËÐУ¬Õâ¸öº¯Êý ......

400¶à¸öJavaScriptÌØÐ§´óÈ«

400¶à¸öJavaScriptÌØÐ§´óÈ«£¬°üº¬È«²¿Ô´´úÂëºÍÏêϸ´úÂë˵Ã÷£¬²»¿É¶àµÃ
JavaScriptʵÏÖ¿ÉÒÔÍêÈ«×ÔÓÉÍÏ×§µÄЧ¹û£¬´øÈý¸ö·¶Àý     http://www.sharejs.com/showdetail-501.aspx 
javascriptʵÏÖ¿ÉÒÔ×ÔÓÉÍ϶¯µÄÊ÷ÐÎÁÐ±í     http://www.sharejs.com/showdetail-500.aspx  ......

javascriptÀïµÄdocument.allÓ÷¨

1
¡¢Àí½âdocument.all
[]
¡¡¡¡´ÓIE4¿ªÊ¼IEµÄobject
model²ÅÔö¼ÓÁËdocument.all
[],À´¿´¿´document.all
[]µÄDescription:
Array
of all HTML tags in the document.Collection of all elements contained by the
object.
¡¡¡¡Ò²¾ÍÊÇ˵document.all
[]ÊÇÎĵµÖÐËùÓбêÇ©×é³ÉµÄÒ»¸öÊý×é±äÁ¿£¬°üÀ¨ÁËÎĵµ¶ÔÏóÖÐËùÓ ......

javascriptµÄϵͳº¯Êý

javascriptµÄϵͳº¯Êý
1£¬encodeURI·½·¨
     ·µ»Ø¶ÔÒ»¸öURI×Ö·û´®±àÂëÖеĽá¹û£¬±¾ÖÊÊÇUTF-8±àÂë
     eg:
     var urlStr = encodeURI('http://fanli.qq.com/index.html?a=ddd&msg=Öйú');
     alert(urlStr);
2, decodeUR ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ