javascript δ½áÊøµÄ×Ö·û´®³£Á¿
½ñÌìÔÚ×öJAVASCRIPTµÄʱºò,·¢ÏÖÀÏÊdzöÏ֔δ½áÊøµÄ×Ö·û´®³£Á¿”.
×Ô¼ºÕÒÁËÏÂÓ¦¸ÃÊÇ´«²ÎÊýµÄʱºò,ÓÐÌØÊâ×Ö·ûÒýÆðµÄ.ÍøÉÏÒ²ÕÒÁËÏÂ,Ò²Óкöà³öÏÖÕâÖÖÇé¿ö.×öÏÂ×ܽá,ÒÔ·½±ãÒÔºó²éÔÄ.
1.JAVASCRIPTÒýÓÃʱ,ʹÓõÄ×Ö·ûÓïÑÔ²»Ò»ÖÂ.
±ÈÈç:<script type=”text/javascript” src=”xxx.js” charset=”UTF-8″>.xxx.jsÎļþÄÚ²¿Ê¹ÓõÄÊÇGB2312µÄ¸ñʽ,ÍâÃæµ÷ÓÃʹÓõÄÊÇUTF-8,ËùÒÔÎļþÄÚ²¿²¿·ÖÌØÊâ×Ö·ûÒòΪ¸ñʽ²»Ò»ÖÂ,³öÏÖÂÒÂë,Ôì³É´ËÔÒò.
2.JAVASCRIPTÊä³öHTML×Ö·ûʱ,Ç°ºó±ê¼Ç²»Æ¥Åä.
ÕâÖֱȽϳ£¼û,ÍùÍùÔÚÊä³ö×Ö·û´®Ê±,³öÏÖµ¥ÒýºÅ(’)»òË«ÒýºÅ(”)²»Åä¶Ô,»òÕßÊÇÔÚdocument.write()µÄʱºò,ûÓÐÕýÈ·Êä³öµ¥ÒýºÅ(’)»òË«ÒýºÅ(”)
3.²ÎÊýÄÚ³öÏÖHTML±ê¼ÇÓïÑÔ»ò°üº¬»»Ðзû
ÎÒ½ñÌìËùÓöµ½µÄÊÇÕâÖÖÇé¿ö.ÒòΪÎÒËùµÃµ½µÄÊý¾ÝÒÔ²ÎÊýÐÎʽ´«¸øÒ»º¯Êý,½á¹û¸ÃÊý¾ÝÀï°üº¬»»Ðзû,Ôì³ÉÁË´Ë´íÎó.
Èç:Ò»°ã²âÊÔʱֻʹÓõ¥ÐеÄÊý¾Ý,ÊÇÕý³£µÄ,δ³öÏÖÕâ¸ö´íÎó,.
µ±²âÊÔʱʹÓöàÐÐÊý¾Ý,²¢Ê¹ÓûسµÁ´»»ÐÐ,¾Í³öÐÐÁË´Ë´íÎó.ÒòΪÀïÃæ°üº¬ÁË»»Ðзû
¶ÔÓÚµÚ3ÖÖÇé¿ö,ÎҵĽâ¾ö·½·¨ÊÇ:²»Ö±½Ó½«¸ÃÊý¾ÝÒÔ²ÎÊýÐÎʽ´«µÝ,¶øÊÇÏȽ«Æ丳ֵÔÚÒ»¸öÒþ²ØµÄÎı¾ÄÚ,ÐèÒªµ÷Óõĺ¯ÊýÀïÖ»Ðè¶ÁÈ¡¸ÃÎı¾ÀïµÄÄÚÈݼ´¿É.
Ïà¹ØÎĵµ£º
ECMAScriptÓÐÎÞÓô洢µ¥ÔªÊÕ¼¯³ÌÐò£¬µ±ÔÚÔÙûÓжԶÔÏóµÄÒýÓÃʱ£¬³Æ¸Ã¶ÔÏ󱻷ϳý£¨dereference£©ÁË¡£
ÔËÐÐÎÞÓô洢µ¥ÔªÊÕ¼¯³ÌÐòʱ£¬ËùÓзϳýµÄ¶ÔÏ󶼱»Ïú»Ù¡£
°Ñ¶ÔÏóµÄËùÓÐÒýÓö¼ÉèÖÃΪnull£¬¿ÉÒÔÇ¿ÖÆÐԵķϳý¶ÔÏó£¬ÀýÈ磺
var oObject = new Object;
.......
&n ......
ECMAScriptÖУ¬switchÓï¾ä¿ÉÒÔÓÃÓÚ×Ö·û´®£¬¶øÇÒÄÜÓò»Êdz£Á¿µÄֵ˵Ã÷Çé¿ö:
var BLUE="blue" , RED = "red" , GREEN = "green";
switch(sColor)
{
case BLUE: alert("Blue"); break;
&nb ......
withÓï¾ä
ÓÃÓÚÉèÖôúÂëÌض¨¶ÔÏóµÄ×÷ÓÃÓò¡£
Àý£º
var sMessage = "hello world";
with(sMessage)
{
&nbs ......
ShowModalDialogº¯ÊýµÄ¹¦ÄÜ£º
´ò¿ªÒ»¸ö×Ó´°¿Ú£¬²¢ÇÒ¿ÉÓ븸´°¿ÚÏ໥´«µÝÊý¾Ý£¬ËüÓëwindow.openµÄ×î´óÇø±ð¾ÍÔÚÓÚÓÉShowModalDialog´ò¿ª×Ó´°¿Úºó£¬¸¸´°¿Ú½«²»ÄܲÙ×÷¡£
ʹÓ÷½·¨£º
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
²ÎÊý˵Ã÷£º
sURL
±ØÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´Ö¸¶¨¶Ô»°¿òÒªÏ ......