¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£º°Ë¡¢¹¹Ôì¶ÔÏó
ÒýÑÔ
³ýJSONÍ⣬ÔÚJavaScriptÖÐÎÒÃÇ¿ÉÒÔʹÓÃnew²Ù×÷·û½áºÏÒ»¸öº¯ÊýµÄÐÎʽÀ´´´½¨¶ÔÏó¡£ÀýÈ磺
function MyFunc() {}; //¶¨ÒåÒ»¸ö¿Õº¯Êý
var anObj = new MyFunc(); //ʹÓà new ²Ù×÷·û£¬½èÖú MyFun º¯Êý£¬¾Í´´½¨ÁËÒ»¸ö¶ÔÏó
JavaScriptµÄÕâÖÖ´´½¨¶ÔÏóµÄ·½Ê½¿ÉÕæÓÐÒâ˼£¬ÈçºÎÈ¥Àí½âÕâÖÖд·¨ÄØ£¿Æäʵ£¬¿ÉÒÔ°ÑÉÏÃæµÄ´úÂë¸Äд³ÉÕâÖֵȼÛÐÎʽ£º
function MyFunc(){};
var anObj = {}; //´´½¨Ò»¸ö¶ÔÏó
MyFunc.call(anObj); //½« anObj¶ÔÏó×÷Ϊ this Ö¸Õëµ÷ÓÃMyFuncº¯Êý
new²Ù×÷·û¾Í¿ÉÒÔ·Ö½âΪ£¬Ö´ÐÐÒýÇæÏÈ´´½¨Ò»¸ö¶ÔÏó£¬È»ºóÔÙ½«Õâ¸ö¶ÔÏ󴫵ݸøº¯Êý£¬×÷Ϊº¯ÊýµÄthis£¬²¢Ö´Ðиĺ¯Êý¡£
¹¹Ô캯Êý
¿´µ½´Ë´¦ÓÐÈËÒ²Ðí»áÏ룬Ϊʲô²»²»°ÑÉÏÃæµÄMyFuncº¯Êý×÷Ϊanobj¶ÔÏóµÄ¹¹Ô캯Êý£¿ºÇºÇ£¬Èç¹ûÄãÏëµ½Á˾ÍÌ«´ÏÃ÷ÁË£¬ÒòΪJavaScriptÒ²ÊÇÕâôÏëµÄ²¢ÇÒ¾ÍÊÇÕâô×öµÄ£¬¿´ÏÂÃæµÄ´úÂ룺
<script language="javascript">
function person(name){ //¹¹Ô캯Êýperson
this.name = name;
this.say = function(){alert("hello, i'm " + this.name);}
}
function employee(name, salary){ //¹¹Ô캯Êýemployee
//½«employee¶ÔÏ󴫵ݸøpersonµÄthis²¢µ÷ÓÃpersonº¯Êý£¬ËùÒÔperson¾ÍÏ൱ÓÚemployee¶ÔÏóµÄ¹¹Ô캯ÊýÁË
person.call(this, name);
this.salary = salary;
this.showMoney = function(){alert("my salary is " + this.salary);}
}
var bill = new person("BillGates");
var jek = new employee("jekbaor", 5000);
bill.say();
jek.say();
jek.showMoney();
alert(bill.constructor == person); //true£¬±íÃ÷bill¶ÔÏóʹÓÃpersonº¯Êý¹¹Ôì
alert(jek.constructor == employee); //true£¬±íÃ÷jek¶ÔÏóʹÓÃemployeeº¯Êý¹¹Ôì
alert(bill.say == jek.say); //false
</script>
Õâ¶Î´úÂë±íÃ÷£¬º¯Êý²»µ«¿ÉÒÔµ±×÷¹¹Ô캯Êý£¬¶øÇÒ»¹¿ÉÒÔ´ø²ÎÊý£¬»¹¿ÉÒÔΪ¶ÔÏóÌí¼Ó³ÉÔ±ºÍ·
Ïà¹ØÎĵµ£º
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>FLYSO Blog-- JS´úÂëʵÏÖµÄ×Ô¶¯·ÖҳЧ¹û~!</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT=""& ......
JavaScript
º¯Êý¶¨ÒåÓï·¨×ܽá
×÷Õß
»Æ³Ï
QQ
Ⱥ£º
65643887
1
£®Õý³£µÄ¶¨Òå·½·¨£º
function functionName([arguments]){
Javascript statements
[return expression]
}
Àý
1:
function evalScript( i, elem ) {
&n ......
°æȨÉùÃ÷
£º¿ÉÒÔÈÎÒâתÔØ£¬µ«×ªÔØʱ±ØÐë±êÃ÷Ô×÷Õßcharlee¡¢ÔʼÁ´½Óhttp://tech.idv2.com/2006/11/23/javascript-strreplace-benchmark/
ÒÔ¼°±¾ÉùÃ÷¡£
¸ÐлClearΪÎÒÃÇÌṩÁËÕâ¸öЧÂʸü¸ßµÄ×Ö·û´®Ìæ»»º¯Êý
¡£ÕâÊǾ³£Ê¹ÓõÄHTMLÌØÊâ×Ö·ûÌæ»»º¯Êý£¬¼´½« &¡¢<¡¢>¡¢" µÈº¯ÊýÌæ»»³É &¡¢<¡¢>¡¢&qu ......
Thickbox
-
»ùÓÚ
jQuery
£¬Ö§³Ö AJAX£¬ÇáÁ¿¼¶µÄ¶øÇұȽϸßЧ¡£Ö§³ÖͼƬÓëHTMLÄÚÈÝ¡£´óСԼΪ
40k£¬Ä¿Ç°»¹¿É×÷Ϊ WordPress
µÄ²å¼þʹÓá£Õâ¸öjsµÄÓŵãÔÚÓÚÓ룬¸¸¼¶µÄÔÒ³Ãæ¹ö¶¯ÌõËæÊó±ê¹ö¶¯µÄʱºò£¬µ¯³öµÄ²ã²¢²»Òƶ¯£¬¶øʼÖÕ´¦ÓÚä¯ÀÀÆ÷µÄ¹Ì¶¨Î»Öá£
GreyBox
- ´´½¨ iframe µÄµ¯³ö½çÃ棬¿ÉʹÓÃͼƬ ......
ÒýÑÔ
ÒªÀí½â JavaScript£¬ÄãµÃÊ×ÏÈ·Å϶ÔÏóºÍÀàµÄ¸ÅÄ»Øµ½Êý¾ÝºÍ´úÂëµÄ±¾Ô¡£Ç°Ãæ˵¹ý£¬±à³ÌÊÀ½çÖ»ÓÐÊý¾ÝºÍ´úÂëÁ½ÖÖ»ù±¾ÔªËØ£¬¶øÕâÁ½ÖÖÔªËØÓÖÓÐמÀ²ø²»ÇåµÄ¹Øϵ¡£JavaScript¾ÍÊÇ°ÑÊý¾ÝºÍ´úÂ붼¼ò»¯µ½×îÔʼµÄ³Ì¶È¡£
»ù±¾ÀàÐÍ
Ò»¡¢¼òµ¥Êý¾ÝÀàÐÍ£ºundefined¡¢null¡¢boolean¡¢number¡¢string£¨×¢Ò⣺¶¼Ê ......