[JavaScript]ÀàÖ®¶þ
javascript ÀඨÒå4ÖÖ·½·¨
Java´úÂë
/*
¹¤³§·½Ê½--- ´´½¨²¢·µ»ØÌض¨ÀàÐ͵ĶÔÏóµÄ ¹¤³§º¯Êý £¨ factory function £©
*/
function createCar(color,doors,mpg){
var tempCar = new Object;
tempCar.color = color;
tempCar.doors = doors;
tempCar.mpg = mpg;
tempCar.showCar = function(){
alert(this.color + " " + this.doors);
}
return tempCar;
}
/*
¹¹Ô캯Êý·½Ê½--- ¹¹Ô캯Êý¿´ÆðÀ´ºÜÏñ¹¤³§º¯Êý
*/
function Car(color,doors,mpg){
this.color = color;
this.doors = doors;
this.mpg = mpg;
this.showCar = function(){
alert(this.color);
};
}
/*
ÔÐÍ·½Ê½--- ÀûÓÃÁ˶ÔÏóµÄ prototype ÊôÐÔ£¬¿É°ÑËü¿´³É´´½¨Ð¶ÔÏóËùÒÀÀµµÄÔÐÍ
*/
function Car(color,doors,mpg){
this.color = color;
this.doors = doors;
this.mpg = mpg;
this.drivers = new Array("nomad","angel");
} &nb
Ïà¹ØÎĵµ£º
Óï·¨
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] )
sURL ¿ÉÑ¡. URL ×Ö·û´® . Èç¹ûURLΪ¿Õ, ½«ÒÔabout:blank´ò¿ª.
sName ¿ÉÑ¡. ×Ö·û´® ÃèÊö´ò¿ª´°¿ÚµÄÃû×Ö(name). ¿ÉÒÔ×öΪform ºÍ a ±êÇ©µÄTARGETÊôÐÔÖµ .
sFeatures ¿ÉÑ¡. ×Ö·û´® ¸ñʽÈç"fullscreen=yes,toolbar=yes".channelmode = { yes | no | ......
½ñÌì¿´jQueryµÄʱºò·¢ÏÖµÄÊéдÐÎʽÔÀ´Ã»Óмû¹ý ÈçÏ£º
(function(){
statement
...
})();
²»Àí½â£¬ºóÀ´ÉÏÍø²éÁËһϣ¬ÔÀ´ÊÇjavascriptÄäÃûº¯ÊýµÄµ÷Ó÷½Ê½
http://zhidao.baidu.com/question/95789340.html
javascript ¿ÉÒÔÒÔÏ·½Ê½µ÷Óú¯Êý
ÉùÃ÷
a = function(){};
µ÷ÓÃ
a();
¿ÉÒÔÀí½âΪ
(function(){ ......
ÕâÈý¸öÓïÑÔ·Ö±ðÊÇÈý¸ö¹«Ë¾¿ª·¢µÄ£¬SUNµÄJava£¬NetscapeµÄJavaScript£¬MicrosoftµÄJScript
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJavaÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬ËüµÄÇ°ÉíÊÇLive Script¡£
JScriptÊÇÒ»ÖÖÀàËÆJavaScriptµÄÓïÑÔ¡ ......
Ê×ÏÈ¿´demo´úÂ룺
var student={
name:"leo",
intro:function(){
alert("my name is "+this.name);
}
}
var teacher=function(f){
f();
}
teacher(student.intro);
ÔÚÉÏÃæµÄdemo£¬¿ÉÒÔ¿´µ½ÏÔʽµÄ¶¨ÒåÁËÒ»¸ö¶ÔÏóstudent£¬ÓÐÒ»¸ö³ÉÔ±º¯ÊýintroºÍÒ»¸ö³ÉÔ±±äÁ¿¡£
ÁíÍⶨÒåÁËÒ»¸öº¯Êýteacher£¬½ÓÊ ......