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

JavaScript ¼Ì³Ð myhere

// ѧϰҪÏ뿽±´ÄÇô¿ì¾ÍºÃÁË
//
// JavaScript µÄ¼Ì³ÐÊÇ»ùÓÚ prototype µÄ£¬Ã¿¸ö¶ÔÏóµÄ prototype ÊDZ£´æÔÚ¶ÔÏóµÄ __proto__ ÊôÐÔÖеģ¬Õâ¸öÊôÐÔÊÇÄÚ²¿(internal)µÄÊôÐÔ( ¹ßÀýÊÇÄÚ²¿µÄ»òÕßÒþ²ØµÄÊôÐÔÒÔ _ ¿ªÍ·)
// A prototype-based language has the notion of a prototypical object, an object used as a template from which to get the initial properties for a new object.
//
/**
* Property lookup in Javascript looks within an object's own properties and,
* if the property name is not found, it looks within the special object property __proto__.
* This continues recursively; the process is called "lookup in the prototype chain".
* The special property __proto__ is set when an object is constructed;
* it is set to the value of the constructor's prototype property.
* So the expression new Foo() creates an object with __proto__ == Foo.prototype.
* Consequently, changes to the properties of Foo.prototype alters the property lookup for all objects that were created by new Foo().
*/
// ¸ø¶ÔÏóµÄÔ­ÐÍÔö¼Ó³ÉÔ±»áÁ¢¼´ÔڸöÔÏóÖпɼû
function Base(){
this.name = 'myhere';
}
function Sub(){
this.age = 23;
}
Sub.prototype = new Base(); // ¸øÔ­Ð͸³ÖµÎªÒ»¸ö==¶ÔÏó==¡£

var me = new Sub();

// ´´½¨¶ÔÏóºó¸øÔ­ÐÍÔö¼Ó sex ÊôÐÔ£¬¸ÃÊôÐÔÁ¢¼´ÔÚ¶ÔÏóÖпɼû
Base.prototype.sex = 'male';

var str = '';
str += me.name + me.age + me.sex;
document.write( str); // myhere23male
/**
* ˵Ã÷£º
* ¶ÔÓÚÕâÖּ̳У¬ÔÚƵ·±ÐÞ¸ÄÔ­Ð͵ÄÇé¿öϾͱäµÃ»ìÂÒÁË
*/
//
/**
* ÁíÒ»Öּ̳з½·¨
*/
function Base(){
this.name = 'myhere';
}
// ²¢Ã»Óн« Sub µÄÔ­Ð͸³ÖµÎª Base£¬Ö»ÊÇÔÚ Sub Öе÷Óà Base º¯Êý
function Sub(){
this.age = 23;
Base.call( this); // Ö»Êǽ«Ò»²¿·Ö³õʼ»¯½»¸ø Base º¯Êý£¬²¢Ã»ÓвÙ×÷ prototype
}

var me = new Sub();

Base.prototype.sex = 'male'; // ÐÞ¸Ä Base ²»»áÓ°Ïì Sub µÄ¶ÔÏó£¬ÒòΪ Base ²¢²»ÊÇ Sub µÄÔ­ÐÍ
// Èç¹û½«Õâ¸öÔö¼Ó sex µÄÓï¾ä·Åµ½ Sub ¶¨ÒåÇ°£¬ÔÚ me ÖÐÒ²µÃ²»µ½ sex ÊôÐÔ£¬
// ÒòΪ Base.call() Ö»Êǵ÷Óà Base º¯Êý¶øÒÑ

var str = '';
str += me.name + m


Ïà¹ØÎĵµ£º

һЩ±È½Ï³£¼ûµÄJavascript¿ò¼Ü¼ò½é

Dojo
      Ò»¸öÇ¿´óµÄÃæÏò¶ÔÏójavascript¿ò¼Ü¡£
      Ö÷ÒªÓÉÈý´óÄ£¿é×é³É£ºCore¡¢Dijit¡¢DojoX¡£
      CoreÌṩ Ajax£¬events£¬packaging£¬CSS-based querying£¬animations£¬JSONµÈÏà¹Ø²Ù×÷API¡£
      Dijit ......

JavaScriptÖÐArray£¨Êý×飩µÄÊôÐԺͷ½·¨

Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......

ͼƬÎÞ·ì¹ö¶¯´úÂë(DIV+CSS+JavaScript)

<div id="imgbox" style="height:110px;width:600px;overflow:hidden;">
<div id="imgbox1" style="float:left;width:1000%">
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif" mce_src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif">
<img src="http://www ......

ÓÃjavascript·ÃÎʲÙ×÷iframeÀïµÄdom

 
ºÜ¶àÈËÒ»Ö±¶¼ÓиöÏë·¨£¬ÒªÊÇ¿ÉÒÔËæÐÄËùÓûµÄ²Ù×÷iframe¾ÍºÃÁË¡£ÕâÑù¾²Ì¬Ò³ÃæÒ²¾ÍÓÐÁËÏ൱ÓÚºǫ́¶¯Ì¬Ò³Ãæphp,jsp,aspÖÐinclude£¬requireʵÏÖͳһ¶àÒ³Ãæ²¼¾ÖµÄÄÜÁ¦¡£
ͨ¹ýJavascriptµÄ°ïæÎÒÃÇ¿ÉÒÔÏñºǫ́һÑù¶¯Ì¬¼ÓÔزÙ×÷iframe¶ÔÏóÊôÐÔsrcÖ¸ÏòµÄhtmlÒ³ÃæµÄÄÚÈÝ¡£ÕâÑùµÄ²Ù×÷ÐèÒªÌṩÁ½¸öÒ³Ã棬һ¸öÒ³ÃæÊÇiframeËùÔÚÒ³ ......

ÏòAsp.netÒ³ÃæÌí¼Ójavascript½Å±¾

1¡¢Ê¹ÓÃPage.ClientScript.RegisterClientScriptBlock
RegisterClientScriptBlock·½·¨¿ÉÒÔ°ÑJavaScriptº¯Êý·ÅÔÚÒ³ÃæµÄ¶¥²¿¡£Ò²¾ÍÊÇ˵£¬¸Ã½Å±¾ÓÃÓÚÔÚä¯ÀÀÆ÷ÖÐÆô¶¯Ò³Ãæ¡£
Code
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object send ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ