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
Ïà¹ØÎĵµ£º
¾³£ÔÚie6ϳöÏÖjavascriptÒ³ÃæÌø×ªºÍ±íµ¥Ìá½»ÎÊÌ⣬ie6ÏÂʵÏÖjavascriptÒ³ÃæÌø×ªºÍ±íµ¥Ìá½»ÐèÒª½øÐÐÌØ±ð´¦Àí£¬ÐèҪʹÓÃsetTimeout()º¯ÊýÑÓ³ÙʵÏÖ¡£
1£¬¼æÈݸ÷ä¯ÀÀÆ÷µÄJavascriptÒ³ÃæÌø×ª
setTimeout(function(){
window.location.href = url;
},0);
2£¬¼æÈݸ÷ä¯ÀÀÆ÷µÄJavascript±íµ¥Ìá½»
setTimeout(function ......
ÔçÉÏÔÚcsdnÉÏ¿´ÓÐÈËÎÊÒ³Ãæstyle sheetÔõôÐÞ¸ÄÀïÃæµÄrule,¾ÍдÁ˸öÀà,¸ÃÀà¶Ô¼æÈÝFFºÍIE×öÁË´¦Àí¡£
/**//*--------------------------------------------
ÃèÊö : Ìí¼ÓеÄÑùʽrule
²ÎÊý : styleSheetsË÷Òý
´úÂë :&nb ......
ת×Ô£º
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ͼƬÅÜÂíµÆ</title>
</head>
<body>
<div style="overflow:hidden; width:350px" id='div'>
<!-- ÕâÀïÊǵÚÒ»¸ö¹Ø¼üµã£¬o ......
Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......
JavaScriptÖÐtoGMTStringº¯Êý·½·¨ÊÇ·µ»ØÒ»¸öÈÕÆÚ£¬¸ÃÈÕÆÚÓøñÁÖÍþÖαê׼ʱ¼ä (GMT) ±íʾ²¢Òѱ»×ª»»Îª×Ö·û´®¡£Ê¹Ó÷½·¨£º
dateObj .toGMTString()
JavaScriptÖÐtoGMTStringº¯Êý·½·¨ÒѾ¹ýʱ£¬Ö®ËùÒÔÈÔÈ»ÌṩÕâ¸ö·½·¨£¬Ö»ÊÇΪÁËÌṩÏòºóµÄ¼æÈÝÐÔ¡£ÍƼö¸ÄÓà toUTCString ·½·¨¡£
toGMTString ·½·¨·µ»ØÒ»¸ö String ¶ÔÏó£¬´Ë ......