Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScript »ù´¡¼¼ÇÉ(1)

1£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
<script language=”JavaScript”>
        JavaScript code goes here
</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 
oman';">= “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


Ïà¹ØÎĵµ£º

JavaScriptÌØÐ§£ºÊ±¼äµ¹Êý

var Tid;
var SetTime=4*60*60*1000;  //ÉèÖúÁÃëÊý£¬1000ºÁÃëΪ1Ãë
function LTime(){
    var MyDiv=document.getElementById("mydiv");
    var Time,TempTime,Days,Hours,Minutes,Seconds;
    
  &n ......

JavascriptÅжϿոñ

ÕýÔò
<script>
 function checkvalue(){
 if(document.Form.content.value.replace(/\s/g,"")=="")
 {
 alert("ÄÚÈݲ»ÄÜΪ¿Õ!");
 document.addForm.content.focus();
 return false;
 }
 document.addForm.submit();
 return ......

javascriptµÄdomReady

»ù±¾ÉÏÿ¸ö¿â¶¼ÓÐÕâ¶«Î÷£¬ÒòΪÈç¹ûÒª¶ÔÒ³ÃæÉϵÄÔªËØ½øÐвÙ×÷£¬ÎÒÃDZØÐëµÈµ½Ò³Ãæ¼ÓÔØÁËÕâ¸öÔªËØ²ÅÐУ¬·ñÔò»á±¨´í£¬µ«ÊÇÎÒÃǺÜÄÜÅж¨Ä³¸öÔªËØÊÇ·ñÒѼÓÔØ£¬µ«ÎÒÃÇ¿ÉÒÔÅж¨Ò³ÃæÊÇ·ñ¼ÓÔØ£¬Õâ¾ÍÊÇÎÒÃǾ­³£°Ñ´úÂë·Åµ½window.onload = function(){}Ö®ÖеÄÔµÓÉ¡£µ«window.onloadʼþÊÇ´ýµ½Ò³ÃæÉϵÄËùÓÐ×ÊÔ´±»¼ÓÔØ²Å¼¤»î£¬Èç¹ûÒ³ÃæÉÏÓ ......

javascriptµÄdocument¶ÔÏóÏê½â(ת)

document Îĵ²¶ÔÏó - JavaScript½Å±¾ÓïÑÔÃèÊö
---------------------------------------------------------------------
×¢:Ò³ÃæÉÏÔªËØnameÊôÐÔºÍJavaScriptÒýÓõÄÃû³Æ±ØÐëÒ»Ö°üÀ¨´óСд
   ·ñÔò»áÌáʾÄãÒ»¸ö´íÎóÐÅÏ¢ "ÒýÓõÄÔªËØÎª¿Õ»òÕß²»ÊǶÔÏó"
------------------------------------------------------ ......

javascriptÖ®HTML£¨select option£©Ïê½â

Ò»¡¢»ù´¡Àí½â:
var e = document.getElementById("selectId");
e. options= new Option("Îı¾","Öµ") ;
//´´½¨Ò»¸öoption¶ÔÏó,¼´ÔÚ<select>±êÇ©Öд´½¨Ò»¸ö»ò¶à¸ö<option value="Öµ">Îı¾</option>
//optionsÊǸöÊý×é,ÀïÃæ¿ÉÒÔ´æ·Å¶à¸ö<option value="Öµ">Îı¾</option>ÕâÑùµÄ±êÇ©
1:opt ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ