ÄÇЩÏà¼ûºÞÍíµÄ JavaScript ¼¼ÇÉ
JavaScript µÄ³É¹¦ÈÃÈ˽ò½òÀÖµÀ£¬Îª Web ÍøÒ³±àд JavaScript ´úÂëÒѾÊÇËùÓÐ Web
Éè¼ÆʦµÄ»ù±¾¹¦£¬ÕâÃÅÓÐȤµÄÓïÑÔÔ̲Ø×ÅÐí¶à²»ÎªÈËÊìÖªµÄ¶«Î÷£¬¼´Ê¹¶àÄêµÄ JavaScript ³ÌÐòÔ±£¬Ò²Î´ÄÜÍêÈ«³Ô͸¡£±¾ÎÄ´Ó7¸ö·½Ãæ½²Êö
JavaScript ÖÐÄÇЩÄã²»ºÜÊìÖªµ«·Ç³£ÊµÓõļ¼ÇÉ¡£
¼òÂÔÓï¾ä
JavaScript ¿ÉÒÔʹÓüòÂÔÓï¾ä¿ìËÙ´´½¨¶ÔÏóºÍÊý×飬±ÈÈçÏÂÃæµÄ´úÂ룺
¿ÉÒÔʹÓüòÂÔÓï¾äÈçÏ£º
¶ÔÏó car ¾Í´Ë´´½¨£¬²»¹ýÐèÒªÌرð×¢Ò⣬½áÊø»¨À¨ºÅÇ°Ò»¶¨²»Òª¼Ó ";" ·ñÔòÔÚ IE »áÓöµ½ºÜ´óÂé·³¡£
´´½¨Êý×éµÄ´«Í³·½·¨ÊÇ£º
ʹÓüòÂÔÓï¾äÔò£º
ÁíÒ»¸ö¿ÉÒÔʹÓüòÂÔÓï¾äµÄµØ·½ÊÇÌõ¼þÅжÏÓï¾ä£º
¿ÉÒÔ¼òÂÔΪ£º
JSON Êý¾Ý¸ñʽ
JSON
ÊÇ
"JavaScript Object Notation" µÄËõд£¬ÓÉ Douglas Crockford Éè¼Æ£¬JSON ¸Ä±äÁË
JavaScript ÔÚ»º´æ¸´ÔÓÊý¾Ý¸ñʽ·½ÃæµÄÀ§¾³£¬ÈçÏÂÀý£¬¼ÙÈçÄãÒªÃèÊöÒ»¸öÀÖ¶Ó£¬¿ÉÒÔÕâÑùд£º
Äã¿ÉÒÔÔÚ JavaScript ÖÐÖ±½ÓʹÓà JSON£¬ÉõÖÁ×÷ΪijЩ API µÄ·µ»ØÊý¾Ý¶ÔÏó£¬ÒÔÏ´úÂëµ÷ÓÃÖøÃûÊéÇ©ÍøÕ¾ delicious.com
µÄÒ»¸ö API£¬·µ»ØÄãÔÚ¸ÃÍøÕ¾µÄËùÓÐÊéÇ©£¬²¢ÏÔʾÔÚÄã×Ô¼ºµÄÍøÕ¾£º
JavaScript ±¾µØº¯Êý (Math, Array ºÍ String)
JavaScript ÓкܶàÄÚÖú¯Êý£¬ÓÐЧµÄʹÓ㬿ÉÒÔ±ÜÃâºÜ¶à²»±ØÒªµÄ´úÂ룬±ÈÈ磬´ÓÒ»¸öÊý×éÖÐÕÒ³ö×î´óÖµ£¬´«Í³µÄ·½·¨ÊÇ£º
ʹÓÃÄÚÖú¯Êý¿ÉÒÔ¸üÈÝÒ×ʵÏÖ£º
ÁíÒ»¸ö·½·¨ÊÇʹÓà Math.max() ·½·¨£º
Äã¿ÉÒÔÓÃÕâ¸ö·½·¨°ïÖú̽²âä¯ÀÀÆ÷
Õâ½â¾öÁË IE ä¯ÀÀÆ÷µÄÒ»¸öÎÊÌ⣬ͨ¹ýÕâÖÖ·½·¨£¬Äã×ÜÊÇ¿ÉÒÔÕÒµ½ÄǸöÕýÈ·µÄÖµ£¬ÒòΪä¯ÀÀÆ÷²»Ö§³ÖµÄÄǸöÖµ»á·µ»Ø undefined¡£
»¹¿ÉÒÔʹÓà JavaScript ÄÚÖÃµÄ split() ºÍ join() º¯Êý´¦Àí HTML ¶ÔÏóµÄ CSS ÀàÃû£¬Èç¹û HTML
¶ÔÏóµÄÀàÃûÊÇ¿Õ¸ñ¸ô¿ªµÄ¶à¸öÃû×Ö£¬ÄãÔÚΪËü×·¼Ó»òɾ³ýÒ»¸ö CSS
ÀàÃûµÄʱºòÐèÒªÌرð×¢Ò⣬Èç¹û¸Ã¶ÔÏó»¹Ã»ÓÐÀàÃûÊôÐÔ£¬¿ÉÒÔÖ±½Ó½«ÐµÄÀàÃû¸³ÓèËü£¬Èç¹ûÒѾ´æÔÚÀàÃû£¬ÐÂÔöµÄÀàÃûÇ°±ØÐëÓÐÒ»¸ö¿Õ¸ñ£¬Óô«Í³µÄ
JavaScript ·½·¨ÊÇÕâÑùʵÏֵģº
ʹÓà split ºÍ join ·½·¨ÔòÖ±¹ÛÓÅÑŵöࣺ
ʼþ´úÀí
ÓëÆäÔÚ HTML
ÎĵµÖÐÉè¼ÆÒ»¶Ñʼþ£¬²»ÈçÖ±½ÓÉè¼ÆÒ»¸öʼþ´úÀí£¬¾ÙÀý˵Ã÷£¬¼ÙÈçÄãÓÐһЩÁ´½Ó£¬Óû§µã»÷ºó²»Ïë´ò¿ªÁ´½Ó£¬¶øÊÇÖ´ÐÐij¸öʼþ£¬HTML ´úÂëÈçÏ£º
´«Í³µÄʼþ´¦ÀíÊDZéÀú¸÷¸öÁ´½Ó£¬¼ÓÉϸ÷×ÔµÄʼþ´¦Àí£º
ʹÓÃʼþ´úÀí£¬¿ÉÒÔÖ±½Ó´¦Àí£¬ÎÞÐè±éÀú£º
ÄäÃûº¯ÊýÓë Module ģʽ
JavaScript
µÄÒ»¸öÎÊÌâÊÇ£¬ÈκαäÁ¿£¬º¯Êý»òÊǶÔÏ󣬳ý·ÇÊÇÔÚij¸öº¯ÊýÄÚ²¿¶¨Ò
Ïà¹ØÎĵµ£º
<script language="javascript">
function ShowTableRow(id)
{
var _Row = document.getElementById(id) <!-- »ñÈ¡IDΪTableRowID µÄ¶ÔÏó -->
var _Img = document.getElementById("Img"+id)
&nb ......
css,javascriptµÄÔ¤¼ÓÔØ
ΪÁËÌá¸ßÍøÕ¾µÄ¼ÓÔØËٶȣ¬ÓÐÒ»¸öºÜÖØÒªµÄÊֶξÍÊÇÔÚÓû§ä¯ÀÀ¹ý³ÌÖеÄÉÏÓÎÍøÕ¾×öÒ»¸öÎļþµÄÔ¤¼ÓÔØ¡£Ô¤¼ÓÔØÎļþÒ»°ãÓÐÁ½ÖÖ³£Óõķ½Ê½£ºxhrºÍ¶¯Ì¬²åÈë½ÚµãµÄ·½Ê½¡£¶¯Ì¬²åÈë½ÚµãÊÇ×îΪ¼òµ¥Ò²×îΪ¹ã·ºµÄÒ»ÖÖÒì²½¼ÓÔØ·½Ê½(ÀýÈçyuiµÄGetÄ£¿é)£¬È»ºóʹÓö¯Ì¬²åÈë½Úµã·½·¨¼ÓÔصÄÎļþ¶¼»áÔÚ¼ÓÔغóÁ¢¼´Ö´ÐУ¬ ......
ΪÁËÌá¸ßÍøÕ¾µÄ¼ÓÔØËٶȣ¬ÓÐÒ»¸öºÜÖØÒªµÄÊֶξÍÊÇÔÚÓû§ä¯ÀÀ¹ý³ÌÖеÄÉÏÓÎÍøÕ¾×öÒ»¸öÎļþµÄÔ¤¼ÓÔØ¡£Ô¤¼ÓÔØÎļþÒ»°ãÓÐÁ½ÖÖ³£Óõķ½Ê½£ºxhrºÍ¶¯Ì¬²åÈë½ÚµãµÄ·½Ê½¡£¶¯Ì¬²åÈë½ÚµãÊÇ×îΪ¼òµ¥Ò²×îΪ¹ã·ºµÄÒ»ÖÖÒì²½¼ÓÔØ·½Ê½(ÀýÈçyuiµÄGetÄ£¿é)£¬È»ºóʹÓö¯Ì¬²åÈë½Úµã·½·¨¼ÓÔصÄÎļþ¶¼»áÔÚ¼ÓÔغóÁ¢¼´Ö´ÐУ¬javascriptµÄÖ´ÐÐÒ»·½Ãæ»áÕ ......
Ò».ʹÓÃRegisterStartUpScript×¢²áÖ»Ö´ÐÐÒ»´ÎµÄjavascript
µÚ1²½(´´½¨²¢×¢²á²¢Ê¹ÓÃjavascript)£ºPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//´´½¨JavaScript
string info = "<mce:script type="text/javascript"><!--alert('ÄãºÃ£¬ÎÒÊÇXXX£¡')// --></mce:scrip ......
1 javascript ÕýÔò
¶ÔÏó´´½¨ ºÍÓ÷¨
ÉùÃ÷javascript ÕýÔò
±í´ïʽ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:
var reCat = new RegExp("cat");
ÄãÒ²¿ÉÒÔ
var reCat = /cat/; //Perl ·ç¸ñ £¨ÍƼö£©
2 ѧϰ×î³£ÓÃµÄ test exec match search replace split 6¸ö·½·¨
1£© test ¼ì²éÖ¸¶¨µÄ×Ö·û´®ÊÇ·ñ´æÔÚ
¸´ÖÆ´úÂë
......