JavaScriptʹÓ÷½·¨ºÍ¼¼ÇÉ´óÈ«
JavaScriptʹÓ÷½·¨ºÍ¼¼ÇÉ´óÈ«
ÓÐЩʱºòÄ㾫ͨһÃÅÓïÑÔ£¬µ«ÊǻᷢÏÖÄãÆäʵÕûÌìÔÚºÍÆäËüÓïÑÔ´ò½»µÀ£¬Ò²ÐíÄãÒÔΪÕâЩ΢²»×ãµÀ£¬²»ÖÁÓÚÓ°ÏìÄãµÄ¿ª·¢½ø¶È£¬µ«Ç¡Ç¡ÊÇÕâЩÄã²»ÖØÊӵĶ«Î÷»áÀË·ÑÄãºÜ¶àʱ¼ä£¬ÎÒÒ»Ö±ÒÔΪÎÒÔçÔÚ¼¸ÄêÇ°¾ÍÒѾ¾«Í¨JavaScriptÁË£¬Ö±µ½Ä¿Ç°£¬ÎÒ²ÅÔ½À´Ô½¾õµÃJavaScriptÔ¶±ÈÎÒÏëÏóµÄ¸´ÔÓºÍÇ¿´ó£¬ÎÒ¿ªÊ¼³ç°ÝËü£¬¾ÍÏñ³ç°ÝËùÓÐOOPÓïÑÔÒ»Ñù¡«
³Ã׎ÚÈյĿÕ϶£¬°ÑÓйØJavaScriptµÄ·½·¨ºÍ¼¼ÇÉÕûÀíÏ£¬ÈÃÿ¸öÔÚΪJavaScript¶ø·³ÄÕµÄÈËÃ÷°×£¬JavaScript¾ÍÕâô»ØÊ£¡²¢Ï£ÍûJavaScript»¹¿ÉÒÔ³ÉΪÄãµÄÅóÓÑ£¬ÈÃÄã»íÈ»¿ªÀÊ£¬ÔÚÏîÄ¿ÖиüºÃµÄÓ¦Óá«
ÊʺÏÔĶÁ·¶Î§£º¶ÔJavaScriptÒ»ÎÞËùÖª¡«À뾫ֻͨ²îÒ»²½Ö®Ò£µÄÈË
»ù´¡ÖªÊ¶£ºHTML
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() +
Ïà¹ØÎĵµ£º
À´Ô´£ºhttp://www.diybl.com/course/1_web/javascript/jsjs/2007114/83289.html
Ç¿ÖÆÀàÐÍת»»
ʹÓÃÇ¿ÖÆÀàÐÍת»»£¨type casting£©´¦Àíת»»ÖµµÄÀàÐÍ¡£Ê¹ÓÃÇ¿ÖÆÀàÐÍת»»¿ÉÒÔ·ÃÎÊÌض¨µÄÖµ£¬¼´Ê¹ËüÊÇÁíÒ»ÖÖÀàÐ͵ġ£JSÖпÉÓõÄ3ÖÖÇ¿ÖÆÀàÐÍת»»ÈçÏ£º
Boolean(value)——°Ñ¸ø¶¨µÄÖµ ......
JavaScript ´úÂëÈçÏ£º
<span id="time" style="background:red">10</span>ÃëÖÓºóÌø»ØÖ÷Ò³£¡Èç¹û²»ÌøתÇëµã»÷
<script language="JavaScript1.2" type="text/javascript">
function delayURL(url, time) {
var delay= document.getElementById("time").i ......
·¢ÏÖΪ±¾ÎÄÆðÒ»¸öºÏÊʵıêÌ⻹²»ÊÇÄÇôÈÝÒ×£¬ºÇºÇ£¬ËùÒÔÔÚ´ËÏÈ˵Ã÷ϱ¾ÎĵÄÁ½¸öÄ¿µÄ£º
£¨1£©½éÉÜjavascriptÖеÄevalº¯ÊýµÄÓ÷¨
£¨2£©ÈçºÎÔÚº¯ÊýÄÚÖ´ÐÐÈ«¾Ö´úÂë
►ÏÈÀ´ËµevalµÄÓ÷¨£¬ÄÚÈݱȽϼòµ¥£¬ÊìϤµÄ¿ÉÒÔÌø¹ý¡£
evalº¯Êý½ÓÊÕÒ»¸ö²ÎÊýs£¬Èç¹ûs²»ÊÇ×Ö·û´®£¬ÔòÖ±½Ó·µ»Øs¡£·ñÔòÖ´ÐÐsÓï¾ä¡£Èç¹ûsÓï¾äÖ´Ðнá¹ûÊÇÒ»¸ö ......
Ê×ÏÈÄãÒª¸ãÇå³þÒ»¼þ¶«Î÷£¬¾ÍÊÇJAVA JAVASCRIPT³ýÁ˳¤µÄÏóÒÔÍâûÓÐÒ»ÑùµÄµØ·½£¬JAVAÊÇÒÀÀµÓÚJAVAÐéÄâ»úÔËÐеÄÒ»ÖÖÃæÏò¶ÔÏóµÄÇ¿ÀàÐÍÓïÑÔ£¬JAVASCRIPTÊÇÒÀÀµÓÚä¯ÀÀÆ÷µÄÒ»ÖÖÈôÀàÐÍÓïÑÔ
javascripºÍcssÊÇǶÌ×ÔÚaspÓïÑÔÖеÄ
×ÜÖ®£¬Ë³Ðò¾ÍÊÇ£º
¾²Ì¬ÍøÒ³ÖÆ×÷£ºhtml
ÍøÒ³Èý½£¿Í ......
ðÅÝÐÍʼþ ʼþ·¢ÉúÓÉÄÚ¶øÍâ
¿ÉÒÔ¶Ôʱ¼ä´«µÝº¯ÊýÒÔÓ¦¶Ô¶¯×÷µÄ´Ù·¢
oP.attachEvent("onclick",fnClick); ¶Ô¶ÔÏóÔö¼ÓÒ»¸ö¼àÌýº¯Êý£¬Í¬Ò»¸ö¶ÔÏó¿ÉÒÔ¼àÌýÏàͬʼþ¶ÔÓ¦²»Í¬µÄʼþ´¦Àíº¯Êý Ö´ÐÐ˳ÐòºóÓÅÏÈ oP.detachEvent("onclick",fnClick);ɾ³ý¼àÌý ÊʺÏÓÃÓ ......