Javascript DOM ±à³ÌÒÕÊõ
JSÖÐÊý×éµÄÅúÁ¿Ìî³ä·½Ê½:
1.ÔÚÉùÃ÷ʱͬʱ½øÐÐÌî³ä
var beatles = Array("John","Paul","George","Ringo");
2.ÎÒÃÇÉõÖÁÓò»×ÅÃ÷È·µØ±íÃ÷ÎÒÃÇÊÇÔÚ´´½¨Êý×é.ÊÂʵÉÏ,Ö»ÐèÓÃÒ»¶Ñ·½À¨ºÅÀ¨ÆðÀ´¾Í×ãÒÔ´´½¨ÎÒÃÇÏëÒªµÄÊý×éÁË:
var beatles = ["John","Paul","George","Ringo"];
JSÖеĹØÁªÊý×é
:JSÖÐÊý×éϱ겢²»¾ÖÏÞÓÚÕûÊý.Êý×éϱê¿ÉÒÔÊÇ×Ö·û´®:
var lennon = Array();
lennon["name"]="John";
lennon["year"]="1940";
´ÓijÖÖÒâÒåÉϽ²,ÍêÈ«¿ÉÒÔ°ÉËùÓеÄÊý×鶼¿´×öÊǹØÁªÊý×é.ÊýÖµÊý×éÖ»²»¹ýÊǹØÁªÊý×éµÄÒ»ÖÖÌØÀý.
CSS²ãµþÑùʽ±í¶¨Ò巽ʽ:
<p class="special">This<p>
<h2 class="special">So<h2>
1.ÔÚÑùʽ±íÀï,ÎÒÃÇ¿ÉÒÔÏñÏÂÃæÕâÑùΪclassÊôÐÔÖµÏàͬµÄËùÓÐÔªËض¨ÒåÒ»ÖÖ¹²ÏíµÄÑùʽ:
.special{
font-style: italic;
}
2.ÎÒÃÇ»¹¿ÉÒÔÏñÏÂÃæÕâÑùÀûÓÃclassµÄÊôÐÔΪһÖÖÌض¨ÀàÐ͵ÄÔªËض¨ÒåÒ»ÖÖ¶ÀÏíµÄÑùʽ:
h2.spical{
text-tansform:uppercase;
}
3.idÊôÐÔµÄÓÃ;ÊǸøÍøÒ³ÀïµÄij¸öÔªËؼÓÉÏÒ»¸ö¶ÀÒ»ÎÞ¶þµÄ±êʶ·û
<ul id="purchase">
ÔÚÑùʽ±íÀïÎÒÃÇ¿ÉÒÔÏñÏÂÃæÕâÑùΪÓÐ×ÅÌض¨idÊôÐÔÖµµÄÔªËض¨ÒåÒ»ÖÖ¶ÀÏíµÄÑùʽ:
#purchase{
border:1px;
color:#CCC;
}
4.ÎÒÃÇ»¹¿ÉÒÔÏñÏÂÃæÕâÑùÀûÓÃIDÊôÐÔΪ°üº¬ÔÚij¸ø¶¨Ô¹¶¾ÀïµÄÆäËûÔªËض¨ÒåÑùʽ,Èç´Ë¶¨ÒåµÄÑùʽ½«Ö»×÷ÓÃÓÚ°üº¬ÔÚÕâ¸ö¸ø¶¨ÔªËØÀïµÄÓйØÔªËØ
#purchase li{
font-weight:bold;
&n
Ïà¹ØÎĵµ£º
Ç°×ࣺ
eval¿ÉÒÔ½«×Ö·û´®Éú³ÉÓï¾äÖ´ÐУ¬ºÍSQLµÄexec()ÀàËÆ¡£
evalµÄʹÓó¡ºÏÊÇʲôÄØ£¿ÓÐʱºòÎÒÃÇÔ¤ÏȲ»ÖªµÀÒªÖ´ÐÐʲôÓï¾ä£¬Ö»Óе±Ìõ¼þºÍ²ÎÊý¸øʱ²ÅÖªµÀÖ´ÐÐʲôÓï¾ä£¬Õâʱºòeval¾ÍÅÉÉÏÓó¡ÁË¡£¾Ù¸öÀý×Ó£º
ÎÒÃÇÒª×öÒ»¸öfunction()£¬¹¦ÄÜÊÇÊäÈëÍøÒ³ÖÐÁ½¸ö¸ö¶ÔÏóµÄÃû³Æ£¬È»ºó³ÌÐò¾Í½«ÕâÁ½¸ö¶ÔÏóµÄÖµÁª½ÓÆðÀ´Êä³ö¡£
fun ......
¶¨Òå
JavascriptÊÇÒ»ÖÖ½âÊÍÐԵģ¬»ùÓÚ¶ÔÏóµÄ½Å±¾ÓïÑÔ(an interpreted, object-based scripting language)¡£
HTMLÍøÒ³ÔÚ»¥¶¯ÐÔ·½ÃæÄÜÁ¦½ÏÈõ£¬ÀýÈçÏÂÀ²Ëµ¥£¬¾ÍÊÇÓû§µã»÷ijһ²Ëµ¥Ïîʱ£¬×Ô¶¯»á³öÏָò˵¥ÏîµÄËùÓÐ×Ӳ˵¥£¬Óô¿HTMLÍøÒ³ÎÞ·¨ÊµÏÖ£»ÓÖÈçÑéÖ¤HTML±íµ¥(F ......
ÓÐÐí¶àСÇÏÃÅÀ´Ê¹±à³Ì¸ü¼ÓÈÝÒס£ÆäÖÐÖ®Ò»¾ÍÊÇeval()º¯Êý£¬Õâ¸öº¯Êý¿ÉÒÔ°ÑÒ»¸ö×Ö·û´®µ±×÷Ò»¸öJavaScript±í´ïʽһÑùÈ¥Ö´ÐÐËü¡£ÒÔÏÂÊÇËüµÄ˵Ã÷
Eval º¯Êý
¹¦ÄÜ£ºÏȽâÊÍJavascript´úÂ룬ȻºóÔÚÖ´ÐÐËü
Ó÷¨£ºEval(codeString)
codeStringÊÇ°üº¬ÓÐJavascriptÓï¾äµÄ×Ö·û´®£¬ÔÚevalÖ®ºóʹÓÃJavascriptÒýÇæ±àÒë¡£
¾Ù¸öСÀý×Ó£º
......
JavaScriptÔÊÐí´´½¨ºÍ´ò¿ª´ú±íHTMLÎı¾, form¶ÔÏóºÍframeµÄ´°¿Ú.
window¶ÔÏóÊÇJavaScript¿Í»§²ã´Î½á¹¹µÄ×²ã¶ÔÏó,
formÔªËغÍÈ«²¿JavaScript´úÂ붼ÊÇ´æÔÚÓÚÎĵµÖÐ,¶øÎĵµ±»×°Ôؽø´°¿Ú. ΪÁËÀí½â´°¿ÚÔõÑù¹¤×÷,Äã¿ÉÒÔ¿ØÖƲÙ×÷ÕâЩ´°¿Ú.
´ò¿ªºÍ¹Ø±Õ´°¿Ú
µ±
Óû§Æô¶¯(launch)Navigatorʱ,½«×Ô¶¯´´½¨Ò»¸ö´°¿Ú.Óû§»¹¿ÉÒ ......