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

JavaScript ¹¹½¨ÀàºÍ´´½¨¶ÔÏóµÄ·½Ê½

1>¹¤³§º¯ÊýÀ´´´½¨¶ÔÏó(Factory)
     function createCar(){
var obj = new Object;
obj.name = "BWM";
obj.show = function(){
alert(this.name);
}
return obj;
}
var car1 = createCar();
var car2 = createCar();
car1.show();
car2.show();
2>¹¹Ô캯Êý´´½¨¶ÔÏó(Constructor)
     function Car(name){
this.name = name;
this.show = function(){
alert(this.name);
}
}
Car.prototype.say = function(){
alert("hello");
}
var car = new Car("BMW");
car.show();
car.say();
3>Ô­ÐÍ£¨prototype£©´´½¨¶ÔÏó
      function Car(){}
Car.prototype.name = "BMW";
Car.prototype.show = function(){
alert(this.name);
}
Car.prototype.say = function(){
alert("Hiloo");
}
var car = new Car();
car.show(); car.say();
4>¹¹Ôì && Ô­ÐÍ£ºÍƼöʹÓ㬵«ÊÇÀí½âÆðÀ´ÓеãÄ£ºý
     /*
¹¹Ô캯ÊýÊÇÀ´³õʼ»¯·Çº¯ÊýÊôÐÔµÄ
*/
function Car(name){
this.name = name;
}
Car.prototype.show = function(){
alert(this.name);
}
Car.prototype.say = function(){
alert("hiloo");
}
var car = new Car("BMW");
car.show(); car.say();
5>Dynamic Prototype£ºÀàËÆÓÚjavaÖÐÀàµÄ´´½¨£¬ÊÇѧϰ¹ýJavaÓïÑÔ³ÌÐòÔ±³£Óõķ½Ê½
    function Car(name){
this.name = name;
if(typeof Car._initialized == "undefined"){
Car.prototype.show = function(){
alert(this.name);
}
Car._initialized = true;//¸Ä±äÄ¿µÄÊÇ£¬Ö´ÐÐÒ»´Î
}
}
var car = new Car("BMW");
car.show();


Ïà¹ØÎĵµ£º

IEºÍFirefoxÔÚcss,JavaScript·½ÃæµÄ¼æÈÝÐÔ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃ() ......

JavaScriptµÄÁíÍâÁ½Öּ̳лúÖÆ

1>zInherit£º
      ËüÊÇÒ»¸ö×é¼þ£¬ÓÃÀ´¼Ì³Ð»ùÀàµÄËùÓÐÊôÐԺͷ½·¨¡£¸úÒÔǰ˵µ½µÄÔ­ÐÍÁ´Ä£Ê½·Ç³£ÀàËÆ£¬Ö»²»¹ý±ÈÔ­Ð͸ü°²È«£¬Ò²ÎÞÐ뿼ÂDzÎÊýÎÊÌâ¡£ÏÂÃæ¿´¿´zInheritµÄÓ÷¨£º
      ¸Ã×é¼þÖÐÖ»ÓÐÁ½¸ö·½·¨£ºinheritfrom() instanceof()
     func ......

ʹÓÃjavascript¶¯Ì¬Ìí¼ÓºÍɾ³ýtableµÄÐкÍÁÐ

µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃinsertRowÌí¼ÓÐУ¬Ê¹ÓÃinsertCellÌí¼Óµ¥Ôª¸ñ£¬ÔÙÓÃinnerHTMLÌî³äµ¥Ôª¸ñ¡£Ê¹ÓÃdeleteRowɾ³ýÐУ¬´úÂëÈçÏ£º
Javascript´úÂ룺
function addRow()
  {
     var root = document.getElementById("tbody")
     var&nb ......

javascriptͼƬä¯ÀÀÆ÷µÄºËÐÄ——ͼƬԤ¼ÓÔØ

javascriptͼƬä¯ÀÀÆ÷µÄºËÐÄ——ͼƬԤ¼ÓÔØ
2009-04-06 10:57
      ÍøÕ¾¿ª·¢Ê±¾­³£ÐèÒªÔÚij¸öÒ³ÃæÐèҪʵÏÖ¶Ô´óÁ¿Í¼Æ¬µÄä¯ÀÀ£¬Èç¹û¿¼ÂÇÁ÷Á¿µÄ»°£¬´ó¿ÉÒÔÏñpconlineÒ»Ñùÿ¸öÒ³ÃæÖ»ÏÔʾһÕÅͼƬ£¬ÈÃÓû§Ã¿¿´Ò»ÕÅͼƬ¾ÍÐèÒªÖØÐÂÏÂÔØÒ»ÏÂÕû¸öÒ³Ãæ¡£²»¹ý£¬ÔÚweb2.0ʱ´ú£¬¸ü¶àÈËÔ¸ÒâÓÃjavas ......

javascript¼ì²âä¯ÀÀÆ÷ÀàÐͺͰ汾

Èç¹û¶ÔjavascriptÁ˽ⲻÊÇÌرðÉîÈëµÄ»°,ºÜÈÝÒ׾ͻáд³ö²»¼æÈݵĴúÂë(¾ÍÏñÎÒ),Õâʱºò¾ÍµÃÅжÏä¯ÀÀÆ÷ÁË¡£±ÈÈçʼþÕìÌý¡¢Ò»Ð©Êó±êºÍ¼üÅÌʼþ¡¢RangeµÈ,һЩ¶¼»á²»Ò»Ñù.ÏÂÃæÁгö¼¸ÖÖ³£Óõļì²âä¯ÀÀÆ÷·½·¨£¬ÒÔ÷ϹÛÖÚ!
¶ÔÏó/ÌØÕ÷¼ì²â·¨
¸Ã·½·¨ÊÇÒ»ÖÖÅжÏä¯ÀÀÆ÷ÄÜÁ¦£¨¶ø·Çä¯ÀÀÆ÷µÄÈ·ÇÐÐͺţ©µÄͨÓ÷½·¨¡£´ó²¿·ÖJSר¼ÒÈÏΪÕâ¸ö·½· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ