javascriptдÀ෽ʽ֮¶þ
2¡¢ÔÐÍ·½Ê½
/**
* PersonÀࣺ¶¨ÒåÒ»¸öÈË£¬ÓиöÊôÐÔname£¬ºÍÒ»¸ögetName·½·¨
*/
function Person(){}
Person.prototype.name = "jack";
Person.prototype.getName = function() { return this.name;}
°ÑÀàµÄÊôÐÔ£¨×ֶΣ©£¬·½·¨¶¼¹ÒÔÚprototypeÉÏ¡£
Ô켸¸ö¶ÔÏó²âÊÔÏ£º
var p1 = new Person();
var p2 = new Person();
console.log(p1.getName());//jack
console.log(p2.getName());//jack
¿ÉÒÔ¿´³öÊä³öµÄ¶¼ÊÇjack£¬ËùÒÔÔÐÍ·½Ê½µÄȱµã¾ÍÊDz»ÄÜͨ¹ý²ÎÊýÀ´¹¹Ôì¶ÔÏóʵÀý
(Ò»°ãÿ¸ö¶ÔÏóµÄÊôÐÔÊDz»ÏàͬµÄ)
£¬ÓŵãÊÇËùÓжÔÏóʵÀý¶¼¹²ÏígetName·½·¨£¨Ïà¶ÔÓÚ¹¹Ô캯Êý·½Ê½£©£¬Ã»ÓÐÔì³ÉÄÚ´æÀË·Ñ
¡£
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
ÔÚJSÖУ¬´´½¨¶ÔÏó£¨Create Object£©²¢²»ÍêÈ«ÊÇÎÒÃÇʱ³£ËµµÄ´´½¨Àà¶ÔÏó£¬JSÖеĶÔÏóÇ¿µ÷µÄÊÇÒ»ÖÖ¸´ºÏÀàÐÍ£¬JSÖд´½¨¶ÔÏó¼°¶Ô¶ÔÏóµÄ·ÃÎÊÊǼ«ÆäÁé»îµÄ¡£
JS¶ÔÏóÊÇÒ»ÖÖ¸´ºÏÀàÐÍ£¬ËüÔÊÐíÄãͨ¹ý±äÁ¿Ãû´æ´¢ºÍ·ÃÎÊ£¬»»Ò»ÖÖ˼·£¬¶ÔÏóÊÇÒ»¸öÎÞÐòµÄÊôÐÔ¼¯ºÏ£¬¼¯ºÏÖеÄÿһÏÓÉÃû³ÆºÍÖµ×é³É£¨ÌýÆðÀ´ÊDz»ÊǺÜÏñÎÒÃdz£Ìý˵µÄHASH±í¡¢× ......
1. ¶¨ÒåÒ»¸öÓÃÓÚÊä³öJavaScript´úÂë µÄServletÀà¡£
package com.mycompany.response.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServle ......
×÷ÓÃÓò Scope
Javascript Öеĺ¯ÊýÊôÓÚ´Ê·¨×÷ÓÃÓò£¬Ò²¾ÍÊÇ˵º¯ÊýÔÚËü±»¶¨ÒåʱµÄ×÷ÓÃÓòÖÐÔËÐжø²»ÊÇÔÚ±»Ö´ÐÐʱµÄ×÷ÓÃÓòÄÚÔËÐС£ÕâÊÇϬţÊéÉϵÄ˵·¨¡£µ«“¶¨Òåʱ”ºÍ“Ö´ÐУ¨±»µ÷Óã©Ê±”ÕâÁ½¸ö¶«Î÷ÓÐЩÈ˸㲻Çå³þ¡£¼òµ¥À´Ëµ£¬Ò»¸öº¯ÊýAÔÚ“¶¨Òåʱ”¾ÍÊÇ function A(){} Õâ¸öÓï¾äÖ´ÐеÄʱºò¾Í ......
SCRIPT 񈬀
ÓÃÓÚ°üº¬JavaScript´úÂë.
ÊôÐÔ
LANGUAGE ¶¨Òå½Å±¾ÓïÑÔ
SRC ¶¨ÒåÒ»¸öURLÓÃÒÔÖ¸¶¨ÒÔ.JS½áβµÄÎļþ
window¶ÔÏó
ÿ¸öHTMLÎĵµµÄ¶¥²ã¶ÔÏó.
ÊôÐÔ
frames[] ×ÓèåÊý×é.ÿ¸ö×ÓèåÊý×é°´Ô´ÎĵµÖж¨ÒåµÄ ......