WebµÄ½á¹¹¡¢ÐÐΪºÍ±íÏÖ¼°JavaScript ÓïÑÔÌØÐÔ
±ê×¼µÄWeb ×é³ÉÓ¦¸Ã°üÀ¨3 ²¿·Ö£º½á¹¹¡¢ÐÐΪºÍ±íÏÖ¡£ÕâÖÖ˼Ïë×îÔçÔÚ΢ÈíÉè¼ÆµÄ
DHTMLÄ£ÐÍÖгõ²½Ìá³öÀ´£¬µ«ÊǺܲ»¹æ·¶£¬Ò²²»³Éϵͳ¡£ºóÀ´£¬W3C£¨World Wide Web
Consortium£¬ÍòάÍøÁªÃË£©×éÖ¯¹æ·¶ÁËWeb µÄ¹¹³É¡£¸ù¾ÝW3C Öƶ©µÄ±ê×¼£¬Web ±ê×¼²»
ÊÇijһ¸ö±ê×¼£¬¶øÊÇһϵÁбê×¼µÄ¼¯ºÏ¡£ÍêÕûµÄWeb Ó¦¸ÃÓÉÒÔÏÂ3 ²¿·Ö×é³É£º
½á¹¹£¨Structure£©
±íÏÖ£¨Presentation£©
ÐÐΪ£¨behavior£©
Õâ 3 ²¿·Ö¶ÔÓ¦µÄʵÏÖ¼¼ÊõÈçÏ¡£
½á¹¹±ê×¼ÓïÑÔ£ºÖ÷Òª°üÀ¨XHTMLºÍXML¡£
±íÏÖ±ê×¼ÓïÑÔ£ºÖ÷Òª°üÀ¨CSS¡£
ÐÐΪ±ê×¼ÓïÑÔ£ºÖ÷Òª°üÀ¨W3C DOM¡¢ECMAScript¡£
ÉÏÃæ¸÷ÖÖ±ê×¼ÓïÑԴ󲿷ÖÓÉW3C×éÖ¯Öƶ©£¬µ«ÊDz¿·Ö±ê×¼Ò²ÓÉÆäËû±ê×¼×éÖ¯Öƶ©£¬Èç
ECMA£¨European Computer Manufacturers Association£¬Å·ÖÞ¼ÆËã»ú³§ÉÌлᣩÖƶ©µÄ
ECMAScript¡£
1.2 ÉóÊÓ JavaScript ÓïÑÔÌØÐÔ
JavaScript ÊÇÒ»ÃÅÁé»îµÄ½Å±¾ÓïÑÔ
JavaScript ÊÇÒ»ÖÖÇáÐ͵ġ¢½âÊÍÐ͵ijÌÐòÉè¼ÆÓïÑÔ¡£Òò´Ë£¬JavaScript Ò»°ã±»×÷ΪǶÈë
ʽ½Å±¾Ê¹Óã¬ÕâҲʹÆä¾ßÓÐÇ¿´óµÄÁé»îÐÔ¡£¿ÉÒÔ˵£¬Áé»îÐÔÊÇJavaScript µÄÁé»ê£¬Äã¿ÉÒÔ
°Ñ³ÌÐòдµÃºÜ¼òµ¥£¬¼òµ¥µ½Ö»ÊÇÒ»ÐÐÑéÖ¤½Å±¾£»µ±È»Ò²¿ÉÒÔдµÃºÜ¸´ÔÓ£¬¸´ÔÓµ½Ò»¸öÅÓ´ó
µÄ¼¼Êõ¿ò¼Ü£¬ÀýÈ磬GoogleµØͼ¾ÍÊÇÒ»¸öºÜÅÓ´óµÄJavaScriptÓ¦ÓÃÏîÄ¿¡£
JavaScript´Óµ®ÉúÆð¾ÍûÓỶ¨Ê½»¯£¬Ôڳɳ¤Öв»¶Ï¼æÈݲ¢È¡£¬ËùÒÔËüÖ§³Ö¶àÖÖ²»Í¬µÄ
±à³Ì·ç¸ñ¡£Äã¿ÉÒÔ²ÉÓú¯Êýʽ±à³Ì·ç¸ñ£¬Ò²¿ÉÒÔ²ÉÓÃÃæÏò¶ÔÏóµÄ±à³Ì·ç¸ñ¡£»òÕßÄãÍêÈ«Å×
Æúº¯Êýʽ±à³Ì»òÃæÏò¶ÔÏó±à³Ì£¬Í¬ÑùÄܹ»Ð´³ö¸´ÔӵijÌÐò¡£
×î¼òµ¥µÄJavaScript ³ÌÐò¿ÉÄܾÍÊÇÒ»¸öº¯Êý£¬Ò»¸ö¼òµ¥µÄº¯Êý¿ÉÄܾÍÊÇÒ»¸ö±í´ïʽ£¬
µ«ÊÇÕâ¸ö±í´ïʽȴÄܹ»¸ßЧÍê³É¸´ÔÓµÄÈÎÎñ¡£Èç¹û˵£¬°ÑJavaScript ÊÓΪһ¸ö¿É°®µÄ»úÆ÷
裬ËæÒâµÄÍ漸¸öÌØЧ£¬ÕâÒ²ÎÞÉË´óÑÅ£¬µ«ÊÇ£¬¼´Ê¹ÊÇÕâ¸ö»úÆ÷裬Ҳ×ãÒÔɱËÀһͷ¹ÖÊÞ¡£
ÕâÕýÊÇJavaScriptÓïÑԵĿɰ®Ö®´¦£¬Ò²ÊÇËüµÄÈåÑÅ·ç¸ñ¡£
JavaScript²»ÆÛÉú£¬Ò²²»Ë£´óÅÆ¡£¶ÔÓÚ±à³ÌµÄÃÅÍ⺺£¬¼òµ¥µÄѧϰ¼´¿É¿ìËÙÉÏÊÖ£¬¼´Ê¹Äã²»ÊDZà³Ì¸ßÊÖ£¬ËæÒâˣŪJavaScript£¬Ò²Äܹ»³Ë·çÆÆÀË¡¢»¢»¢Éú·ç¡£ÎªÁË°ïÖúÄã¸üÖ±¹ÛµØ
ÌåÑéJavaScript ÓïÑÔµÄÁé»îÐÔ£¬ÏÂÃæÎÒÃǽáºÏÒ»¸ö¼òµ¥µÄʾÀý½øÐÐ˵Ã÷£¬Õâ¸öʾÀý½²ÊöÁË
ÈçºÎʹÓò»Í¬µÄ·½·¨Éè¼ÆÒ»¸ö¼òµ¥µÄIO ½Ó¿Ú¶ÔÏó¡£
1£®¹ý³Ì»¯Éè¼Æ
Èç¹ûÒÔ¹ý³Ìʽ³ÌÐòÉè¼ÆµÄ·½·¨À´Éè¼ÆÒ»¸ö¼òµ¥µÄIO½Ó¿Ú£¬ÊµÏֵĴúÂëÈçÏ£º
function set(x){ // ´«Èë
this.x = x;
}
function get(){ // ´«³ö
return this.x;
}
ÕâÖÖ×
Ïà¹ØÎĵµ£º
//ºǫ́CSµ÷ÓÃǰ̨JS·½·¨
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script>CheckInput()</script>");
//УÑéÊäÈë¿òÊÇ·ñΪ¿Õ£¬Ð£ÑéÊÇ·ñÊÇÊý×Ö
<script type="text/javascript" language="javascript">
function CheckInput ......
JavascriptË¢ÐÂÒ³ÃæµÄ¼¸ÖÖ·½·¨£º
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7& ......
JS×Ô´øº¯Êý
concat
½«Á½¸ö»ò¶à¸ö×Ö·ûµÄÎı¾×éºÏÆðÀ´£¬·µ»ØÒ»¸öеÄ×Ö·û´®¡£
var a = "hello";
var b = ",world";
var c = a.concat(b);
alert(c);
//c = "hello,world"
indexOf
·µ»Ø×Ö·û´®ÖÐÒ»¸ö×Ó´®µÚÒ»´¦³öÏÖµÄË÷Òý£¨´Ó×óµ½ÓÒËÑË÷£©¡£Èç¹ûûÓÐÆ¥ÅäÏ·µ»Ø -1 ¡£
var index1 = a.indexOf("l");
//index1 = 2 ......
//°ÑÊý¾ÝдÈëÊý¾Ý¿â
function
res(){
//»ñÈ¡ÊäÈëÖµ(mynameºÍmymailÊÇÁ½¸öÎı¾¿òµÄid)
var
uname = document.getElementById("myname"
).value;
var
umail = document.getElementById("mymail"
).value;
......
ÕâÈý¸öÓïÑÔ·Ö±ðÊÇÈý¸ö¹«Ë¾¿ª·¢µÄ£¬SUNµÄJava£¬NetscapeµÄJavaScript£¬MicrosoftµÄJScript
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJavaÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬ËüµÄÇ°ÉíÊÇLive Script¡£
JScriptÊÇÒ»ÖÖÀàËÆJavaScriptµÄÓïÑÔ¡ ......