JavaScriptÖеÄ×Ö·û´®²Ù×÷
Ò»¡¢¸ÅÊö
×Ö·û´®ÔÚJavaScriptÖм¸ºõÎÞ´¦²»ÔÚ£¬ÔÚÄã´¦ÀíÓû§µÄÊäÈëÊý¾ÝµÄʱºò£¬ÔÚ¶ÁÈ¡»òÉèÖÃDOM¶ÔÏóµÄÊôÐÔʱ£¬ÔÚ²Ù×÷cookieʱ£¬µ±È»»¹Óиü¶à...¡£JavaScriptµÄºËÐIJ¿·ÖÌṩÁËÒ»×éÊôÐԺͷ½·¨ÓÃÓÚͨÓõÄ×Ö·û´®²Ù×÷£¬Èç·Ö¸î×Ö·û´®£¬¸Ä±ä×Ö·û´®µÄ´óСд£¬²Ù×÷×Ó×Ö·û´®µÈ¡£
µ±Ç°µÄ´ó²¿·Öä¯ÀÀÆ÷Ò²ÄÜ´ÓÇ¿´óµÄÕýÔò±í´ïʽ»ñÒ棬ÒòΪËü¼«´óµØ¼ò»¯ÁË´óÁ¿µÄ×Ö·û´®²Ù×÷ÈÎÎñ£¬²»¹ýËüÒ²ÐèÒªÄã¿Ë·þÒ»ÌõÓÐЩ¶¸Ç͵ÄѧϰÇúÏß¡£ÔÚÕâÀÖ÷ÒªÊǽéÉÜ×Ö·û´®±¾ÉíµÄһЩ²Ù×÷£¬ÕýÔò±í´ïʽ»áÔÚÒÔºóµÄËæ±ÊÖÐÉæ¼°¡£
¶þ¡¢×Ö·û´®µÄ´´½¨
´´½¨Ò»¸ö×Ö·û´®Óм¸ÖÖ·½·¨¡£×î¼òµ¥µÄÊÇÓÃÒýºÅ½«Ò»×é×Ö·û°üº¬ÆðÀ´£¬¿ÉÒÔ½«Æ丳ֵ¸øÒ»¸ö×Ö·û´®±äÁ¿¡£
var myStr = "Hello, String!";
¿ÉÒÔÓÃË«ÒýºÅ»òµ¥ÒýºÅ½«×Ö·û´®°üº¬£¬µ«Òª×¢Ò⣬×÷Ϊ½ç¶¨×Ö·û´®µÄÒ»¶ÔÒýºÅ±ØÐëÊÇÏàͬµÄ£¬²»ÄÜ»ìÓá£
Ïñvar myString = "Fluffy is a pretty cat.'; ÕâÑùµÄÉùÃ÷¾ÍÊÇ·Ç·¨µÄ¡£
ÔÊÐíʹÓÃÁ½ÖÖÒýºÅ£¬Ê¹µÃijЩ²Ù×÷±äµÃ¼òµ¥£¬±ÈÈ罫һÖÖǶÈëÁíÍâÒ»ÖÖ£º
document.write("<img src='img/logo.jpg' height='30' width='100' alt='Logo'>");
ÎÒÃÇÔÚÉÏÃæ½Å±¾´´½¨Á˼¸¸ö×Ö·û´®£¬µ«±¾ÖÊÉÏ£¬ËüÃDz¢²»ÊÇÕæÕýµÄ×Ö·û´®¶ÔÏó£¬×¼È·µØ˵£¬ËüÃÇÊÇ×Ö·û´®ÀàÐ͵ÄÖµ¡£Òª´´½¨Ò»¸ö×Ö·û´®¶ÔÏ󣬿ÉʹÓÃÈçÏÂÓï¾ä£ºvar strObj = new String("Hello, String!");
ʹÓÃtypeofÔËËã·û²é¿´»á·¢ÏÖ£¬ÉÏÃæµÄmyStrÀàÐÍΪstring£¬¶østrObjÀàÐÍΪobject¡£
Èç¹ûÏëÖªµÀ×Ö·û´®µÄ³¤¶È£¬Ê¹ÓÃÆälengthÊôÐÔ£ºstring.length¡£
µÃµ½×Ö·û´®µÄÖ¸¶¨Î»ÖõÄ×Ö·ûʹÓ÷½·¨£ºstring.charAt(index);
Èý¡¢×Ö·û´®µÄÆ´½Ó
ÎÊÌ⣺
½«Á½¸ö»ò¶à¸ö×Ö·û´®Æ´½ÓΪһ¸ö´óµÄ×Ö·û´®
½â¾ö·½°¸£º
·Ç³£¼òµ¥£¬¾ÍÓÃÒ»¸ö"+"½«Á½¸ö×Ö·û´®"Ïà¼Ó"£º
var longString = "One piece " + "plus one more piece.";
Òª½«¶à¸ö×Ö·û´®ÀÛ»ýΪһ¸ö×Ö·û´®£¬»¹¿ÉÒÔʹÓÃ"+="²Ù×÷·û£º
var result = "";
result += "My name is Anders"
result += " and my age is 25"; &nbs
Ïà¹ØÎĵµ£º
Ó¢ÎÄÔÎÄ£ºThe seven rules of Unobtrusive JavaScript
ÔÎÄ×÷ÕߣºChris Heilmann
¾¹ý¶àÄêµÄ¿ª·¢¡¢½ÌѧºÍ±àд²»ÌÆÍ»µÄJavaScript£¬ ÎÒ·¢ÏÖÁËÏÂÃæµÄһЩ׼Ôò¡£ÎÒÏ£ÍûËüÃÇ¿ÉÒÔ°ïÖúÄã¶Ô“ΪʲôÕâÑùÉè¼ÆºÍÖ´ÐÐJavaScript±È½ÏºÃ”ÓÐÒ»µãÀí½â¡£ÕâЩ¹æÔòÔø¾°ïÖúÎÒ¸ü¿ìµØ½»¸¶²úÆ·£¬²¢ÇÒ²úÆ·µÄÖÊÁ¿¸ü¸ß£¬Ò²¸üÈÝ ......
ÔÀ´ÊÖ¶¯Ð´AJAXµÄʱºò,Ò»°ã¶¼ÏÈ´´½¨XMLHttpRequest¶ÔÏñµÄ,»òÕßÖ±½ÓÓÃJqueryµÄ·½·¨,Õâ´Î¿´µ½ÕâÖÖ¶¯Ì¬×¢²á½Å±¾Ð´·¨,»¹ÊÇÂùÆæÌصÄ.дÏÂÀ´,¼Ç¼һÏÂ,ºÇºÇ!
ÕâÊÇǰ̨Js´úÂë:
<mce:script type="text/javascript"><!--
var scriptLastID = null;
// »Øµ÷·½·¨
function backFunction(type,content){
......
.×Ö·û´®(String)
1.ÉùÃ÷
var myString = new String("Every good boy does fine.");
var myString = "Every good boy does fine.";
2.×Ö·û´®Á¬½Ó
var myString = "Every " + "goo ......
javascript
ʼþÁбí½â˵
ʼþ
ä¯ÀÀÆ÷Ö§³Ö
½â˵
Ò»°ãʼþ
onclick
IE3¡¢N2
Êó±êµã»÷ʱ´¥·¢´Ëʼþ
ondblclick
IE4¡¢N4
Êó±êË«»÷ʱ´¥·¢´Ëʼþ
onmousedown
IE4¡¢N4
°´ÏÂÊó±êʱ´¥·¢´Ëʼþ
onmouseup
IE4¡¢N4
Êó±ê°´ÏºóËÉ¿ªÊó±êʱ´¥·¢´Ëʼþ
onmouseover
IE3¡¢N2
µ±Êó±êÒƶ¯µ½Ä³¶ÔÏ ......