JavaScript µÄ¼Ì³Ð»úÖÆ
¼Ì³Ð»úÖÆ£¬Ëµµ½¼Ì³Ð£¬¾ÍÒªÏëµ½´Ó»ùÀ࿪ʼ£¬µ«ÊÇJavaScriptÖеÄÀàÓÐÁ½´óÀࣺһ£¬ÄÚǶµÄ£»¶þ£¬Óû§×Ô¶¨Ò壻һ°ãÇ°Õß²»»á±»ÓÃÀ´×ö»ùÀ࣬ÔÒòÊÇΪÁ˱£ÕÏjsµÄ°²È«¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýprototypeÀ´¶Ô»ùÀà½øÐÐÀ©³ä£¬Ôö¼ÓÎÒÃÇÏëÒªµÄÊôÐԺͷ½·¨¡£ÒÔÏÂÊÇ×Ô¼º¶Ô¼Ì³ÐµÄ¼¸ÖÖ·½Ê½µÄÀí½â¡£
1> ¶ÔÏóð³ä£¬ÊÇJavaScript ºÍ ECMAScriptʵÏּ̳еķ½·¨£¬ÔÚѧϰ¶ÔÏóð³äʵÏּ̳ÐÇ°ÎÒÃǵÄÏÈÁ˽â¹Ø¼ü×Ö this µÄʹÓã¬ÀýÈ磺
function classA(color){
this.color = color;
this.show = function(){alert(this.color);}
}
/*
Note:
1> this ´ú±íµÄÊÇclassAº¯ÊýËù¹¹½¨µÄ¶ÔÏ󣬶ø·Çº¯ÊýclassA¶ÔÏó±¾ÉíÕâÑù˵Ö÷ÒªÊÇΪÁ˱ÜÃ⣨function is object£©µÄÓ°Ïì;
2> ÔÚ¹¹½¨classA¶ÔÏóʱ£¬ÊÇͨ¹ýthisÀ´³õʼ»¯µÄÊôÐԺͷ½·¨µÄ£¬Èç¹ûÓÃclassBµÄthisȥð³äclassAµÄthis£¬ÄÇô¾ÍʵÏÖÁ˼òµ¥µÄ¼Ì³ÐÁË
*/
2>¼Ì³Ð»úÖƵÄʵÏÖ·½Ê½£º
NO1£º¶ÔÏóð³ä
¶ÔÏóð³äµÄÔÀí£ºº¯ÊýclassAͨ¹ýthisÀ´³õʼ»¯ÊôÐԺͷ½·¨£¬Èç¹ûÓú¯ÊýclassBµÄthisð³äclassAµÄthisÈ¥Ö´ÐУ¬Ôò¾Í»áʹclassB¾ßÓÐclassAµÄÊôÐԺͷ½·¨¡£ÀýÈç
function classA(sColor){
this.sColor = sColor;
this.show = function(){alert(this.sColor);}
}
function classB(sColor,sName){
this.new = classA;
this.new(sColor);
delete this.new;
/*
Note
±ØÐëÊÍ·ÅclassAµÄÒýÓã¬ÄÇÑù¶ÔÓÚclassAÊÇ°²È«µÄ¡£¿ÉÊÇÔÙÖ´ÐÐÒ»¶ÎÒÔÉÏ´úÂ룬ʵÏÖ¶àÖؼ̳С£
this.new = classC;
this.new(arguments);
delete this.new;
*/
this.sName = sName;
this.say = function(){alert(this.sName);}
}
var a = new classA("blue");
var b = new classB("red","BMW");
a.show(); // blue
b.say(); //BMW
b.show(); // red
×¢Ò⣺¶ÔÏóð³äÊÇËùÓм̳еÄÇ°Ìᣬð³äÖ»ÄÜʹ×ÓÀà¼Ì³Ð»ùÀàÖеÄÊôÐԺͷ½·¨£¬¶Ô»ùÀàprototypeÖеÄÊôÐԺͷ½·¨ÊDz»¿É¼ûµÄ¡£Ò²¿ÉÒÔʵÏÖ¶àÖؼ̳С£
NO2£ºÔÐÍÁ´
ÔÐÍÁ´£¬ÊǼ̳еÄÁíÒ»ÖÖ·½Ê½
Ïà¹ØÎĵµ£º
ÔÚUpdatepanelÖÐʹÓÃJAVASCRIPTµÄÎÊÌâ
ÔÚUpdatePanle×ÜʹÓÃjavascriptÈ磺Response.Write("<script language='javascript'>alert('" + error.Message.ToString() + "');history.back(-1);</script>"); ʱ£¬µ¯³öÀ´Ò»¸öÌáʾ¶Ô»°¿ò
Sys.WebForms.PageRequestManagerParserErrorException:
The message ......
Ò»£¬¸ÅÊö
1£¬ÕýÔò±í´ïʽ£¬¿ÉÒÔ˵ÊÇÈκÎÒ»ÖÖ±à³ÌÓïÑÔ¶¼ÌṩµÄ»úÖÆ£¬ËüÖ÷ÒªÊÇÌṩÁ˶Ô×Ö·û´®µÄ´¦ÀíÄÜÁ¦¡£
2£¬ÕýÔò±í´ïʽÔÚÒ³Ãæ´¦ÀíÖеÄʹÓó¡¾°£º
1£©±íµ¥ÑéÖ¤¡£Ñé֤ijЩÓò·ûºÏijÖÖ¹æÔò£¬ÀýÈçÓʼþÊäÈë¿ò±ØÐëÊäÈëµÄÊÇÓʼþ¡¢ÁªÏµµç»°ÊäÈë¿òÊäÈëµÄ±ØÐëÊÇÊý×ֵȵÈ
2£©´¦ÀíDOMÄ£ÐÍ¡£ÀýÈçͨ¹ý±í´ïʽ¶¨Î»DOMÖеÄÒ»¸ö¶ÔÏó»òһϵÁ ......
×î¶ÌµÄÍ϶¯´úÂë
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script l ......
1.Date
ÊôÐÔ(1):
constructor Ëù½¨Á¢¶ÔÏóµÄº¯Êý²Î¿¼
prototype Äܹ»Îª¶ÔÏó¼ÓÈëµÄÊôÐԺͷ½·¨
·½·¨(43):
getDay() ·µ»ØÒ»ÖÜÖеĵڼ¸Ìì(0-6)
getYear() ·µ»ØÄê·Ý.2000ÄêÒÔǰΪ2λ,2000 ......
1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃ() ......