JAVASCRIPT ½Ì³Ì1 ¸¶Ê×ê¿
JavaScript ÊÇʲ÷᣿
JavaScript ÊÇÒ»ÖÖеÄÃèÊöÓïÑÔ£¬´ËÒ»ÓïÑÔ¿ÉÒÔ±»óéÈë HTML µÄÎļþÖ®ÖС£
͸¹ý JavaScript ¿ÉÒÔ×öµ½»ØӦʹÓÃÕßµÄÐèÇóʼþ (È磺 form µÄÊäÈë) ¶ø²»ÓÃÈκεÄÍø·
À´»Ø´«Êä×ÊÁÏ£¬ËùÒÔµ±Ò»Î»Ê¹ÓÃÕßÊäÈëÒ»Ïî×ÊÁÏʱ£¬Ëü²»Óþ¹ý´«¸øËÅ·þ¶Ë (server)
´¦Àí£¬ÔÙ´«»ØÀ´µÄ¹ý³Ì£¬¶øÖ±½Ó¿ÉÒÔ±»¿Í»§¶Ë (client) µÄÓ¦ÓóÌʽËù´¦Àí¡£ÄãÒ²¿É
ÒÔÏëÏñ³ÉÓÐÒ»¸ö¿ÉÖ´ÐгÌʽÔÚÄãµÄ¿Í¶ËÉÏÖ´ÐÐÒ»Ñù£¡Ä¿Ç°ÒÑÓÐһЩдºÃµÄ³ÌʽÔÚ
Internet ÉÏÄã¿ÉÒÔÁ¬¹ýÈ¥¿´¿´£¬ÒÔÏÂÓÐһЩ¼ÆËãÆ÷µÄÀý×Ó£¬ÔÚ Nescape ÉÏ¡£
JavaScript ºÍ Java ºÜÀàËÆ£¬µ«µ½µ×²¢²»Ò»Ñù£¡ Java ÊÇÒ»ÖÖ±È JavaScript ¸ü¸´ÔÓ
Ðí¶àµÄ³ÌʽÓïÑÔ£¬¶ø JavaScript ÔòÊÇÏ൱ÈÝÒ×Á˽âµÄÓïÑÔ¡£JavaScript ´´×÷Õß
¿ÉÒÔ²»ÄÇ÷á×¢ÖسÌʽ¼¼ÇÉ£¬ËùÒÔÐí¶à Java µÄÌØÐÔÔÚ Java Script Öв¢²»Ö§Ô®¡£
ÈçÐèÏà¹ØµÄ¸ü¶à×ÊѶ£¬¿ÉÒÔÈ¥¶Á¶Á Netscape µÄÓÐ¹Ø Netscape JavaScript Ö®½éÉÜ¡£
--------------------------------------------------------------------------------
ÈçºÎÖ´ÐÐ JaveScript£¿
JavaScript ÈçºÎÖ´ÐÐÄØ£¿
Netscape 2.0 beta 3 °æÒÔÉÏ£¬¾Í¿ÉÒÔÖ´ÐÐ JavaScript µÄ¹¦ÄÜÁË£¬ÎÒÃDzâÊÔ¹ýÖÁÉÙ
beta 3 °æÒÔÉÏ¿ÉÒÔ£¬ÆäËûÖÖÀàµÄ WWW ä¯ÀÀÆ÷Èç:Internet Expore 3.0Ò²ÓдËÒ»¹¦ÄÜ¡£
--------------------------------------------------------------------------------
·¶Àý 1£º
ÒÔÏÂÎÒÃǾÍÒÔһЩÀý×ÓÀ´¸æËßÄãÈçºÎ½« JavaScript дÔÚ HTML ÎļþÖУ¬²¢ÇÒÌå»á
Ò»ÏÂÐÂÓïÑÔµÄÌØÐÔ£¬ÎÒÃÇ´ÓµÚÒ»¸öÀý×Ó¿ªÊ¼£ºÈçºÎÓà JavaScript Ó¡³öÒ»´®ÎÄ×ÖÖÁ
HTML ÎļþÖУº
<html>
<head>
My first JavaScript!
</head>
<body>
<br>
This is a normal HTML document.
<br>
<script language="LiveScript">
document.write("ÕâÊÇÒÔ JavaScript Ó¡³öµÄ!")
</script>
<br>
Back in HTML again.
</body>
</html>
Èç¹ûÄãʹÓÃµÄ WWW ä¯ÀÀÆ÷ÊÇ Netscape 2.0 beta 3 ÒÔÉÏ°æ±¾µÄ»°£¬ÄÇÄã¾Í¿ÉÒÔ
¿´µ½Ïà¹ØµÄ½á¹û£¬¶øÈç¹ûÄãµÄä¯ÀÀÆ÷²¢·ÇÊÇ¿ÉÒÔÖ§Ô® JavaScript µÄ»°£¬ÄÇ¿´Æð
À´¾Í»áÓÐһЩ¹Ö¹ÖµÄÁË£¬ÒÔÉÏ·¶ÀýµÄ½á¹ûÈçÏ£º
This is a normal HTML document.
ÕâÊÇÒÔ JavaScript Ó¡³öµÄ!
Back in HTML again.
´ËÒ»·¶Àý²¢Ã»ÓÐÌ«´óµÄÓô¦£¬ËüÖ»ÊÇÒª¸æËßÄãÈçºÎʹÓÃ<script>µÄ±êÇ©£¬²¢
ÈçºÎ
Ïà¹ØÎĵµ£º
ÓÉÓÚTEXTAREAûÓÐmaxlength,²»ÄÜÕâÑùÏÞÖÆtextarea³¤¶È£¬ µ«Í¨¹ýJAVASCRIPT ¾ÍÄÜʵÏÖµ½
<mce:script type="text/javascript"><!--
function limitLength(obj, length) {
var desc = obj.value;
obj.value = substr(obj.value,length);
}
function substr(str,length){
......
д¸øÏëѧJavascriptÅóÓѵÄÒ»µã¾Ñé̸֮(º¬½Ì²ÄÑ¡È¡Ö¸µ¼)
¹äÂÛ̳ʱ¿´µ½ÓÐÅóÓÑÎÊ£¬ÊÇ·ñÓÐרÃŽÌJavascriptµÄѧУ£¬ÕâÀïÏëÏë°Ñ×Ô¼ºµÄÒ»µã½¨ÒéºÍ×Ô¼º3ÄêÀ´µÄÇ°¶ËJavascript¿ª·¢µÄ¾Ñé¸ú´ó¼Ò·ÖÏíÏ£¬Ò²¸ø³ö¼¸±¾¸öÈËÈÏΪ²»´íµÄÊéÀ´×öΪ´ó¼ÒѧϰµÄ²Î¿¼×ÊÁÏ¡£µ±È»Ö»ÊǸöÈ˵ľÑ飬ÓÐʲô²»¶ÔµÄÒ²Çë¸ßÊÖ¼ûÁºÍÖ¸Õý¡£
¹ØÓÚµ½ÅàÑµÑ ......
µ¥ÌåÊÇÒ»¸öÓÃÀ´»®·ÖÃüÃû¿Õ¼ä²¢½«Ò»ÅúÏà¹ØµÄÊôÐԺͷ½·¨×éÖ¯ÔÚÒ»ÆðµÄ¶ÔÏó£¬Èç¹ûËû¿ÉÒÔ±»ÊµÀý»¯£¬ÄÇôËûÖ»Äܱ»ÊµÀý»¯Ò»´Î¡£
µ¥ÌåģʽÊÇjavascriptÀïÃæ×î»ù±¾µ«Ò²ÊÇ×îÓÐÓõÄģʽ֮һ¡£
Ìص㣺
1. ¿ÉÒÔÀ´»®·ÖÃüÃû¿Õ¼ä£¬´Ó¶øÇå³ýÈ«¾Ö±äÁ¿Ëù´øÀ´µÄΣÏÕ¡£
2. ......
JavascriptÖеij£¼ûÎÊÌâ
1. ¼¯ºÏÀà¶ÔÏóÎÊÌâ
ÏÖÓдúÂëÖÐÐí¶à¼¯ºÏÀà¶ÔÏóÈ¡ÓÃʱʹÓà ()£¬IE ÄܽÓÊÜ£¬Firefox ²»ÄÜ¡£
½â¾ö·½·¨£º¸ÄÓà [] ×÷ΪϱêÔËËã¡£È磺document.forms("formName") ¸ÄΪ
Js´úÂë
document.forms[
"formName"
];
//ÓÖÈ磺
document.getEle ......