Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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¶¯Ì¬Éú³ÉÏÂÀ­Ñ¡Ï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Ö®Ò»

1¡¢ÎÞÌáʾ¹Ø±Õ´°¿Ú
<input type="button" onClick="window.opener = '';window.close();" value="IE6×î¼òµ¥µÄÎÞÌáʾ¹Ø±Õ´°¿Ú" >
2¡¢·ÀÖ¹±»ÈËiframe
if (top.location != self.location)
{
  top.location.href="http://www.34do.net";
}
3¡¢ÅжÏÒ»¸ö¶ÔÏó´æÔÚ²»´æÔÚ
document.all("a")==null£¨²»´æÔÚ£©
......

JavaScriptµÄCookies

ʹÓà Cookies¡¡¡¡ÎÒÃÇÒѾ­ÖªµÀ£¬ÔÚ document ¶ÔÏóÖÐÓÐÒ»¸ö cookie ÊôÐÔ¡£µ«ÊÇ Cookie ÓÖÊÇʲô£¿“ijЩ Web
Õ¾µãÔÚÄúµÄÓ²ÅÌÉÏÓúÜСµÄÎı¾Îļþ´æ´¢ÁËһЩÐÅÏ¢£¬ÕâЩÎļþ¾Í³ÆÎª Cookie¡£”—— MSIE °ïÖú¡£Ò»°ãÀ´Ëµ£¬Cookies ÊÇ CGI
»òÀàËÆ£¬±È HTML ¸ß¼¶µÄÎļþ¡¢³ÌÐòµÈ´´½¨µÄ£¬µ«ÊÇ JavaScript Ò²Ìá¹ ......

JavaScript»ñÈ¡²»Öظ´Ëæ»úÊý

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ëæ»ú ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ