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

JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«


JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«  »ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é  <script language=”JavaScript”> JavaScript code goes here </script>
2 Òþ²Ø½Å±¾´úÂë  <script language=”JavaScript”><!-- document.write(“Hello”); --> </script>
ÔÚ²»Ö§³ÖJavaScriptµÄä¯ÀÀÆ÷Öн«²»Ö´ÐÐÏà¹Ø´úÂë
3 ä¯ÀÀÆ÷²»Ö§³ÖµÄʱºòÏÔʾ  <noscript> Hello to the non-JavaScript browser.</noscript>
4 Á´½ÓÍⲿ½Å±¾Îļþ<script language=”JavaScript” src="/”filename.js"”></script>
5 ×¢Êͽű¾   // This is a comment  
document.write(“Hello”); // This is a comment
/*   All of this  is a comment  */
6 Êä³öµ½ä¯ÀÀÆ÷  document.write(“<strong>Hello</strong>”);
7 ¶¨Òå±äÁ¿   var myVariable = “some value”;
8 ×Ö·û´®Ïà¼Ó var myString = “String1” + “String2”;
9 ×Ö·û´®ËÑË÷  <script language=”JavaScript”><!-- var myVariable = “Hello there”;
var therePlace = myVariable.search(“there”); document.write(therePlace);// --> </script>
10 ×Ö·û´®Ìæ»» thisVar.replace(“Monday”,”Friday”);
11 ¸ñʽ»¯×Ö´® <script language=”JavaScript”><!—
var myVariable = “Hello there”; document.write(myVariable.big() + “<br>”);
document.write(myVariable.blink() + “<br>”); document.write(myVariable.bold() + “<br>”);
document.write(myVariable.fixed() + “<br>”);document.write(myVariable.fontcolor(“red”) + “<br>”);
document.write(myVariable.fontsize(“18pt”) + “<br>”);document.write(myVariable.italics() + “<br>”);
document.write(myVariable.small() + “<br>”);document.write(myVariable.strike() + “<br>”);


Ïà¹ØÎĵµ£º

JavaScript »ñÈ¡¶ÔÏóµÄ¸ß¶ÈºÍ¿í¶ÈÏêϸ˵Ã÷

scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐĿǰ¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×î¶¥¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×î¶¥¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......

Javascript¶¯Ì¬Éú³ÉÏÂÀ­Ñ¡Ïselect£©

1.ÏÈ»ñµÃselect£º
var s = document.getElementById("selectYear");
2.¿ÉÒÔÏÈÒÆ³ýÉÏ´ÎÌí¼ÓµÄoption£¨ÕâÀïҪעÒ⣬ÿ´Îɾ³ýµÄ¶¼ÊǵÚÒ»¸öÔªËØ£¬ÒòΪɾһ¸öÉÙÒ»¸ö£©£º
var l = s.options.length;
for(var i=0;i<l;i++){
    s.options.remove(0);  
}
3.Ìí¼ÓÐÂÔªËØ£¨iÊÇ×Ô¼º¶¨ÒåµÄ£¬¸ù¾Ý× ......

javaScript ºÍ JavaµÄÇø±ð

JavaScriptÓïÑÔºÍJavaÓïÑÔÊÇÏà¹ØµÄ£¬µ«ËüÃÇÖ®¼äµÄÁªÏµ²¢²»ÏñÏëÏóÖеÄÄÇÑù½ôÃÜ¡£  
   
  ¡¡¡¡   ¶þÕßµÄÇø±ðÌåÏÖÔÚ£º  
  ¡¡¡¡   Ê×ÏÈ£¬ËüÃÇÊÇÁ½¸ö¹«Ë¾¿ª·¢µÄ²»Í¬µÄÁ½¸ö²úÆ·£¬JavaÊÇSUN¹«Ë¾ÍƳöµÄÐÂÒ»´úÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬ÌرðÊʺÏÓÚInternetÓ¦ÓóÌÐò¿ª·¢£»¶øJavaScrip ......

Javascript»ñµÃ×ÓÒ³Ãæ±äÁ¿µÄÖµ

Àý£º
page.htmlÒ³Ãæ£º
<html>
<head>
<title>This is a test</title>
</head>
<script type="text/javascript">
var count;
</script>
<body>
<iframe id="child" src="childPage.html" src="childPage"></iframe>
</body>
</html> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ