javascript»ù´¡ÖªÊ¶
javascript£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”javascript”>
2: javascript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”javascript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </script>
ÔÚ²»Ö§³ÖjavascriptµÄä¯ÀÀÆ÷Öн«²»Ö´ÐÐÏà¹Ø´úÂë
3 ä¯ÀÀÆ÷²»Ö§³ÖµÄʱºòÏÔʾ
1: <noscript>
2: Hello to the non-javascript browser.
3: </noscript>
4 Á´½ÓÍⲿ½Å±¾Îļþ
1: <script language=”javascript” src="/”filename.js"”></script>
5 ×¢Êͽű¾
1: // This is a comment
2: document.write(“Hello”); // This is a comment
3: /*
4: All of this
5: is a comment
6: */
6 Êä³öµ½ä¯ÀÀÆ÷
1: document.write(“<strong>Hello</strong>”);
7 ¶¨Òå±äÁ¿
1: var myVariable = “some value”;
8 ×Ö·û´®Ïà¼Ó
1: var myString = “String1” + “String2”;
9 ×Ö·û´®ËÑË÷
1: <script language=”javascript”>
2: <!--
3: var myVariable = “Hello there”;
4: var therePlace = myVariable.search(“there”);
5: document.write(therePlace);
6: // -->
7: </script>
10 ×Ö·û´®Ìæ»»
1: thisVar.replace(“Monday”,”Friday”);
11 ¸ñʽ»¯×Ö´®
1: <script language=”javascript”>
2: <!--
3: var myVariable = “Hello there”;
4: document.write(myVariable.big() + “<br>”);
5: document.write(myVariable.blink() + “<br>”);
6: document.write(myVariable.bold() + “<br>”);
7: document.write(myVariable.fixed() + “<br>”);
8: document.write(myVariable.fontcolor(“red”) + “<br>”);
9: document.write(myVariable.fontsize(“18pt”) + “<br>”);
10: document.write(myVariable.italics() + “<br>”);
11: document.write(myVariable.small() + “<br>”);
12: do
Ïà¹ØÎĵµ£º
×î½ü×öË°Îñ×ÛºÏƽ̨¹¤×÷Á÷£¬ ÔÚÒ³ÃæÉÏÅжÏÊÇ·ñÊÇ“»õ±Ò½ð¶î”¸ñʽ£¬Ê¹ÓõÄÊÇÕýÔò±í´ïʽ£¬Ò»Ö±¶¼Ã»ÓÐÎÊÌ⣬
ºóÀ´Í»È»ÎÞ·¨ÑéÖ¤£¬ ¾ÍÊDz»·ûºÏÕýÔò±í´ïʽµÄ½á¹¹£¬×îºóÖÕÓÚ·¢ÏÖ ½ð¶îºóÃæ°üº¬¿Õ¸ñ×Ö·û´®£¬ÔÚÍøÉÏÕÒµ½Ò»¶Î´úÂë £¬ÕýºÃ½â¾ö¡£
String.prototype.trim= function(){
// ÓÃÕýÔò±í´ïʽ½«Ç°ºó¿ ......
JavascriptË¢ÐÂÒ³ÃæµÄ¼¸ÖÖ·½·¨£º
³ÌÐò´úÂë
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refres ......
½ñÌìÔÚ²©¿ÍÔ°ÉÏ¿´µ½Ò»ÆªÎÄÕ£¬¸ú×ÅѧϰÁËһϣ¬×ª¹ýÀ´Óë´ó¼Ò·ÖÏí£¬²¿·ÖÄÚÈÝÎÒ×öÁ˲¹³ä£¡
Ò»¡¢JavaScriptÕýÔò±í´ïʽ»ù±¾ÖªÊ¶
1¡¢JavaScriptÕýÔò±í´ïʽ´´½¨ºÍÓ÷¨
ÉùÃ÷ÕýÔò±í´ïʽÓÐÁ½ÖÖ·½Ê½£º
a) var reCat = new RegExp("cat");
b) var reCat = /cat/; //perl·ç¸ñ£¨ÍƼö£©& ......
ת×Ôhttp://topic.csdn.net/u/20091014/12/44b0ac69-5228-429b-854a-a91e3736f1d4.html?64368
ÿһÏÊÇJSÖеÄС¼¼ÇÉ£¬µ«Ê®·ÖµÄʵÓã¡
1.document.write(”"); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navig ......
12¿îJavaScript±í¸ñ¿Ø¼þ¡£±í¸ñ¿Ø¼þ(DataGrid )ÔÊÐí×îÖÕÓû§ÔĶÁºÍдÈëµ½¾ø´ó¶àÊýÊý¾Ý¿âµÄÓ¦ÓóÌÐò¡£DataGrid ¿Ø¼þ¿ÉÒÔÔÚÉè¼Æʱ¿ìËÙ½øÐÐÅäÖã¬Ö»ÐèÉÙÁ¿´úÂë»òÎÞÐè´úÂë¡£µ±ÔÚÉè¼ÆʱÉèÖÃÁËDataGrid ¿Ø¼þµÄ DataSource ÊôÐԺ󣬾ͻáÓÃÊý¾ÝÔ´µÄ¼Ç¼¼¯À´×Ô¶¯Ìî³ä¸Ã¿Ø¼þ£¬ÒÔ¼°×Ô¶¯ÉèÖøÿؼþµÄÁбêÍ·¡£È»ºóÄú¾Í ......