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

javascript Öеļ̳з½·¨

1.¿ÉÒÔͨ¹ýprototypeÊôÐÔ£¬ÊµÏּ̳з½·¨µÄ·½Ê½£¬ÕâÖÖ·½Ê½¾ÍÊÇjavaÓïÑÔÖм̳еı任ÐÎʽ¡£
 // Create the constructor for a Person object
function Person( name ) {
    this.name = name;
}
// Add a new method to the Person object
Person.prototype.getName = function() {
    return this.name;
};
Person.prototype.setName = function(name) {
    this.name = name;
};
// Create a new User object constructor
function User( name, password ) {
    // Notice that this does not support graceful overloading/inheritance
    // e.g. being able to call the super class constructor
    this.name = name;
    this.password = password;
};
// The User object inherits all of the Person object's methods
User.prototype = new Person();
2.ͨ¹ý×Ô¼ºÐ´¼Ì³Ðº¯Êý£¬ÊµÏּ̳У¬ÏÂÃæÕâ¶Î´úÂëÒ²ºÜºÃ£¬ÖµµÃÒ»¿´
// A simple helper that allows you to bind new functions to the
// prototype of an object
Function.prototype.method = function(name, func) {
    this.prototype[name] = func;
    return this;
};
// A (rather complex) function that allows you to gracefully inherit
// functions from other objects and be able to still call the  'parent'
// object's function
Function.method('inherits', function(parent) {
    // Keep track of how many parent-levels deep we are
    var depth = 0;
    // Inherit the parent's methods
    var proto = this.prototype = new parent();
    // Create a new 'priveledged' function called 'uber', that when called
    // executes any function that has been written over in the inheritance
    this.method('uber', function uber(name) {
        var func; // The function to be execute
        var ret; // The return value of the function
 &n


Ïà¹ØÎĵµ£º

¹ØÓÚjavascript ÄäÃûº¯ÊýµÄµ÷Ó÷½Ê½

½ñÌì¿´jQueryµÄʱºò·¢ÏÖµÄÊéдÐÎʽԭÀ´Ã»Óмû¹ý ÈçÏ£º
(function(){
statement
...
})();
²»Àí½â£¬ºóÀ´ÉÏÍø²éÁËһϣ¬Ô­À´ÊÇjavascriptÄäÃûº¯ÊýµÄµ÷Ó÷½Ê½
 http://zhidao.baidu.com/question/95789340.html
javascript ¿ÉÒÔÒÔÏ·½Ê½µ÷Óú¯Êý
ÉùÃ÷
a = function(){};
µ÷ÓÃ
a();
¿ÉÒÔÀí½âΪ
(function(){ ......

Java,JavaScript,JScript Çø±ð

ÕâÈý¸öÓïÑÔ·Ö±ðÊÇÈý¸ö¹«Ë¾¿ª·¢µÄ£¬SUNµÄJava£¬NetscapeµÄJavaScript£¬MicrosoftµÄJScript
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJavaÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬ËüµÄÇ°ÉíÊÇLive Script¡£
JScriptÊÇÒ»ÖÖÀàËÆJavaScriptµÄÓïÑÔ¡ ......

javascript£»Æ´Í¼ÓÎÏ·£¨¿É×ÔѡͼƬºÍÉèÖÃÐÐÁÐÊý£©

˼·£ºä¯ÀÀͼƬ£¬¶ÁÈ¡Æä¿í¶ÈImageW£¬¸ß¶ÈÖµImageH¡£¶ÁÈ¡Óû§ÊäÈëµÄ·Ö³É¼¸ÐÐRow¼¸ÁÐCol¡£
         ÿ¸ö·½¿é£ºboxW=ImageW/Col£»boxH=ImageH/Row£»
         ÔÚ1µ½Row*ColÖÐËæ»ú£¬µÚi¸öͼƬµÄλÖÃÉèΪpos¡¾i¡¿¡£È»ºó¶¯Ì¬´´½¨divÉú³ÉRow* ......

[JavaScript]ÀàÖ®Ò»

Ò»¸ö¼òµ¥µÄjavascriptÀඨÒåÀý×Ó
     º­¸ÇÁËjavascript¹«ÓгÉÔ±¶¨Ò塢˽ÓгÉÔ±¶¨Òå¡¢ÌØȨ·½·¨¶¨ÒåµÄ¼òµ¥Ê¾Àý
Java´úÂë
<script>     
    //¶¨ÒåÒ»¸öjavascriptÀà   
    function JsClass(privateParam/*&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ