JavaScriptÖжÔÏóµÄ´´½¨
JavaScriptÖд´½¨¶ÔÏóµÄ·½·¨ÈçÏ£º
Ò»¡¢´´½¨¼òµ¥¶ÔÏó£º
×î¼òµ¥µÄ´´½¨¶ÔÏóµÄ·½·¨¾ÍÊÇÓÃÒ»¸öеÄObject£¬È»ºóÏòÆäÖÐÌí¼ÓÄÚÈÝ£º
ÏÖÔÚµ÷ÓÃmyObject.say(),½«µ¯³ö’gao’µÄ¾¯¸æ¿ò¡£
var myObject = new Object();
myObject.name = ‘gao’;
myObject.say = function(){
alert(this.name);
}
ÔÚJavaScriptÖУ¬Äã¿ÉÒÔÔÙÔËÐÐʱ´´½¨¶ÔÏó£¬ÔÚ¶ÔÏóµÄÕû¸öÉúÃüÖÜÆÚ¶¼¿ÉÒÔÏòËüÌí¼ÓÊôÐÔ¡£
ÊÂʵÉÏ£¬JavaScriptʵÏÖÖ»ÊÇ°ÑËùÓжÔÏóµ±×÷¹ØÁªÊý×é´¦Àí£¬ÀýÈ磬Äã¿ÉÒÔÏñÏÂÃæÕâÑùµ÷ÓøղŵöÔÏó£º
var name = myObject[‘name’];
myObject[‘say’]();
¶þ¡¢Ê¹ÓÃJSON´´½¨¶ÔÏó£º
ÉÏÃæ˵¹ý£¬JavaScriptÀïµÄ¶ÔÏó£¬Ö»ÊǹØÁªÊý×飬Õâ¾ÍÊÇJSON¿ÉÒÔÕý³£¹¤×÷µÄÒòËØ¡£ÓÃJSON´´½¨¶ÔÏóµÄÀý×ÓÈçÏ£º
var myObject = {
name : ‘gao’,
say : function{
alert(this.name);
}
}
ʹÓÃJSONºÍ¶¨ÒåÊý×é·Ç³£ÏàËÆ£¬³ýÁËÐèҪʹÓû¨À¨ºÅ¶ø²»ÊÇ·½À¨ºÅ¡£
ÔÚjQueryµÄÔ´ÂëÖоʹóÁ¿Ê¹ÓÃÁËÕâÖÖ·½Ê½¡£
Èý¡¢Ê¹ÓÃÀàµÄ·½Ê½¶¨Ò壺
ÔÚJavaScriptÖУ¬ËùÓк¯Êý¶¼ÊǶÔÏ󣬶øÀàʵ¼ÊÉϾÍÊÇÒ»¸öº¯Êý£¬Õâ¸öº¯Êý±»µ±×öÀàµÄ¹¹ÔìÆ÷À´Ìṩ·þÎñ¡£ÀඨÒåµÄ·½Ê½£¬ÈÃÄã´´½¨¶ÔÏóʱ£¬²»ÓÃÿ´Î¶¼´ÓÍ·¿ªÊ¼¡£
function MyClass(){
this.name = ‘gao’;
this.say = function(){
alert(this.name);
}
}
var myObject = new MyClass();
myObject.say();
ËÄ¡¢ÔÐÍ·¨£º
ÀඨÒåµÄ·½·¨ËäÈ»×öµ½ÁËÖØÓ㬵«ÊÇÒ²¿ÉÄÜ´øÀ´ÁË´úÂëµÄÈßÓ࣬ÒòΪÄãÿ´Î´´½¨¶ÔÏóʱ£¬¶¼»á¿½±´ÏàͬµÄ¸±±¾£¬µ±Äã²»ÐèÒªÕâЩ¿½±´µÄʱºò£¬±ã¿ÉÒÔʹÓÃÔÐÍ¡£
ÔÐ͵Ť×÷·½Ê½ÊÇ£¬µ±Äã¹¹ÔìÁËÒ»¸öеÄʵÀýʱ£¬¶¨ÒåÔÚ¶ÔÏóÔÐÍÉϵÄËùÓÐÊôÐԺͷ½·¨£¬ÔÚÔËÐÐʱ¶¼»á¸½×ÅÔÚÄǸöеÄʵÀýÉÏ¡£
function MyClass(){
this.name = ‘gao’;
}
MyClass.prototype.say = function(){
alert(this.name);
}
var myObject = new MyClass();
myObject.say();
Ö´ÐеÄʱºò£¬Õâ·Ý´úÂë»áÕý³£¹¤×÷£¬Óë֮ǰ²»Í¬µÄÊÇ£¬ÎÞÂÛÄã´´½¨¶àÉÙ¸öʵÀý£¬ÔÚÄÚ´æÖÐsay()º¯ÊýÖ»ÓÐÒ»·ÝʵÀý¡£Õâ¸ö·½·¨Êµ¼ÊÉÏÊǸ½¼ÓÔÚÿ¸öʵÀýÉϵģ¬¶øÇÒthis¹Ø¼ü×ÖÊÇÔÚÔËÐÐʱ¼ÆËãµÄ¡£ËùÒÔÁ½¸öʵÀýµÄÔËÐл·¾³ÊÇÏà¶Ô¶ÀÁ¢µÄ£º
function MyCl
Ïà¹ØÎĵµ£º
ÐèÇó£º
AÓòÓÐÒ³Ãæa.html£¬ÆäÖÐÓÐiframe°üº¬BÓòµÄÒ³Ãæb.html£¬ÏÖÔÚҪͨ¹ýa.htmlÉϵÄÒ»¸ö°´Å¥£¬À´°Ña.htmlÒ³ÃæÉÏÒ»¸öÎı¾¿òµÄÖµ´«µÝµ½b.htmlÒ³ÃæµÄÎı¾¿ò¡£
×¢£ºÕâÀïb.htmlÊÇhtmlÍøÒ³£¬²»ÄܽÓÊÕÆäËûÍøÕ¾post¹ýÀ´µÄÖµ£¬ËùÒÔ²»ÄÜÓÃÖ±½ÓpostµÄ·½·¨À´´«Öµ£¬µ«ÊÇ£¬Èç¹û½ÓÊÕÒ³ÃæÊÇb.aspx»òÕßb.asp ÄØ£¬ÄDz»ÊÇ¿ÉÒÔÖ±½ÓpostÁËô£¿´ð ......
Òý×Ó
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵľÀ²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»îÁ¦¡£
Êý¾ÝÌìÉú¾ÍÊÇÎľ²µÄ£¬×ÜÏë±£³Ö×Ô¼º¹ÌÓеı¾É«£»¶ø´úÂëÈ´ÌìÉú»îÆã¬×ÜÏë¸Ä±äÕâ¸öÊÀ½ç¡£
Äã¿´£¬Êý¾Ý´úÂë¼äµÄ¹ØϵÓëÎï ......
javascriptÀïÃæûÓÐÏֳɵÄ×Ö·û´®×ª³ÉÈÕÆÚºÍʱ¼äÀàÐ͵ĺ¯Êý£¬Ö»ÄÜÀûÓÃnew Date(y,m,d,h,i,s,ms)»òÕßÆäËüÏàËƵĺ¯Êý½øÐÐת»¯
ÒÔÏÂÊÇÒ»¸öʾÀý
alert(strToDate('2009/1/5 16:40'));
//×Ö·û´®×ªÈÕÆÚÀàÐÍ
function strToDate(str) {
var re=/^(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2}):(\d{1,2})$/g
if(re.tes ......
×Û¹ÛÒ»¸öϵͳµÄ·¢Õ¹£¬ÎÞ·ÇÊÇ·¢ÏÖÒ»¸öÎÊÌâ¾Í°ÑËü¶ÀÁ¢³öÀ´½â¾öµô£¬Òò´ËËüµÄËùÓÐÄ£¿é£¨»òÕß·ÖÖ§£©ÆäʵÕë¶Ô¶ÀÁ¢µÄÎÊÌ⣬ÕâÑùÎÒÃǶÔÕâЩÎÊÌâÈôÓÐʲô¸üºÃµÄ½â¾ö·½·¨£¬Ìæ»»ÏàÓ¦µÄÄ£¿é±ãÊÇ£¬Òª²»´úÂë»ìÔÓÔÚÒ»Æðû·¨¿´ÁË¡£ÉÏÒ»²¿·Ö¾ÍÌáµ½ÁË£¬attachEventµÄʼþÁжӳöÁËЩÎÊÌ⣬ÎÒÃÇÒªÊÖ¶¯¹¹½¨ÁжÓÁË¡£ËùνÁжӾÍÊÇÓÐÏÈÓкóµÄÎÊÌâ£¬Ò ......
var arr=['a','b','c'];
¡¡¡¡ÈôҪɾ³ýÆäÖеÄ'b',ÓÐÁ½ÖÖ·½·¨£º
¡¡¡¡1.delete·½·¨:delete arr[1]
¡¡¡¡ÕâÖÖ·½Ê½Êý×鳤¶È²»±ä,´Ëʱarr[1]±äΪundefinedÁË,µ«ÊÇÒ²Óкô¦ÔÀ´Êý×éµÄË÷ÒýÒ²±£³Ö²»±ä,´ËʱҪ±éÀúÊý×éÔªËØ¿ÉÒÔ²ÅÓÃ
¡¡¡¡for(index in arr)& ......