javascript evalµÄ¼òµ¥Ó÷¨
js eval
evalº¯Êý½ÓÊÕÒ»¸ö²ÎÊýs£¬Èç¹ûs²»ÊÇ×Ö·û´®£¬ÔòÖ±½Ó·µ»Øs¡£·ñÔòÖ´ÐÐsÓï¾ä¡£Èç¹ûsÓï¾äÖ´Ðнá¹ûÊÇÒ»¸öÖµ£¬Ôò·µ»Ø´ËÖµ£¬·ñÔò·µ»Øundefined¡£
Àý×Ó
Ö±½ÓÔËËã
alert(eval('1+2')); // ->3
¸³Öµ
eval('var aa = 5');
alert(aa); // ->5
ÀàÐÍת»»
var yy = "{a:'aa',b:'bb'}";
yy = eval('(' + yy + ')');
alert(yy);
ÐèÒªÌرð×¢ÒâµÄÊǶÔÏóÉùÃ÷Óï·¨“{}”²¢²»ÄÜ·µ»ØÒ»¸öÖµ£¬ÐèÒªÓÃÀ¨ºÅÀ¨ÆðÀ´²Å»á·µ»ØÖµ;
¶ÔÓÚ¶ÔÏóÉùÃ÷Óï¾äÀ´Ëµ£¬½ö½öÊÇÖ´ÐУ¬²¢²»ÄÜ·µ»ØÖµ¡£ÎªÁË·µ»Ø³£Óõē{}”ÕâÑùµÄ¶ÔÏóÉùÃ÷Óï¾ä£¬±ØÐëÓÃÀ¨ºÅÀ¨×¡£¬ÒÔ½«Æäת»»Îª±í´ïʽ£¬²ÅÄÜ·µ»ØÆäÖµ¡£ÕâÒ²ÊÇʹÓÃJSONÀ´½øÐÐAjax¿ª·¢µÄ»ù±¾ÔÀíÖ®Ò»¡£
×îºó»¹Òª¿¼ÂÇ×÷Ó÷¶Î§µÄÎÊÌ⣬¿ÉÒԲο¼ÒÔÏÂÍøÕ¾
http://wanyij.blog.51cto.com/46570/43794
Ïà¹ØÎĵµ£º
1. javascript ÊÇÇø·Ö´óСдµÄ£¬°üÀ¨±äÁ¿¡¢º¯ÊýÃûµÈµÈ¡£
2. javascript ÖеıäÁ¿ÊÇÈõÀàÐ͵ģ¬¶¨Òå±äÁ¿Ê±Ö»Óà var ÔËËã·û¡£
var test1 = "hi";
»òÕß
var test1 = "hi",test2 = "hello";
»òÕß(¿ÉÒÔÊDz»Í¬µÄÀàÐÍ)
var test1 = "hi",test2 = 12;
»òÕß(¿ÉÒÔ²»Óóõʼ»¯)
var test1;
3. javascript ÿÌõÓï¾äµÄ½áβ&ldqu ......
JavaScript For Ñ»·
Previous Page
Next Page
JavaScript ÖеÄÑ»·ÓÃÀ´½«Í¬Ò»¶Î´úÂëÖ´ÐÐÖ¸¶¨µÄ´ÎÊý£¨»òÕßµ±Ö¸¶¨µÄÌõ¼þΪ true ʱ£©¡£
ʵÀý
For Ñ»· ÈçºÎ±àд loop Ñ»·À´°´ÕÕÖ¸¶¨µÄ´ÎÊýÖ´ÐÐÏàͬµÄ´úÂë¡£ Ñ»·²úÉú HTML ±êÌâ ÈçºÎʹÓÃLoopÑ»·À´²úÉú²»Í¬µÄHTML±êÌâ¡£
JavaScript Ñ»·
ÔÚ±àд´úÂëʱ£¬Äã³£³£Ï£Íû· ......
1. º¯ÊýÔÚÖ´ÐÐÍê return Ö¸Áîºó¾Í»áÍ£Ö¹Ö´ÐдúÂë.
function test(Num1,Num2){
return Num1+Num2;
alert(Num1+Num2); //never outputs
}
2. javascript º¯Êý²»ÄÜÖØÔØ,Ò²¾ÍÊÇ˵¿ÉÒÔÔÚͬһ¸ö×÷ÓÃÓòÖж¨Òå¶à¸öͬÃûº¯Êý,¶ø×îÖÕÖ´ÐеÄÊǺóÒ»¸öº¯Êý.
function test(num){
alert(num+10);
}
function ......
Submitted by gouki on 2008, December 4, 11:47 PM. Javascript
ÓÃjavascript+vmlÀ´×ö¹¤×÷Á÷£¬È·ÊµÊǵÚÒ»´Î¿´µ½£¬ËùÒÔÎÒÔÚ¿´µ½ÓÐÕâ¸öÐÂÎŵÄʱºò£¬¾Í¾õµÃÌرðµÄ³Ô¾ª¡£µ±ÄêµÄTRS¾ÍÊÇÒòΪÓÐÒ»¸öactivex°æµÄ¹¤×÷Á÷¿Ø¼þµÄCMS£¬µ¼ÖÂËûµÄ¼Û¸ñ·Ç³£µÄ¸ß£¬½ñÌìÄܹ»¿´µ½ÓÐjavascript°æµÄ£¬¾ªÑÈÊÇÄÑÃâµÄ¡£¡£¡£
Ö»ÊDz¢·ÇËùÓеĻúÆ÷¶¼Ö ......
1. ijЩ»ùÀàÈç¹û²»Ö±½ÓʹÓÃ,¶ø½ö½öÖ»ÊÇÓÃÓÚ¸ø×ÓÀàÌṩͨÓõĺ¯Êý,ÕâÖÖÇé¿öÏÂ,»ùÀà±»¿´×÷³éÏóÀà.
2. ÔÚ javascript µÄÀàÖÐËùÓеķ½·¨ºÍÊôÐÔ¶¼ÊÇ"¹«ÓõÄ".
3. javascript Öеļ̳в¢²»ÊÇÃ÷È·¹æ¶¨µÄ,¶øÊÇͨ¹ýÄ£·ÂÀ´ÊµÏÖµÄ.ÓÐÒÔÏ·½·¨:
(1). ¶ÔÏóð³ä
function A(sColor){
this.color = sColor;
this.showColo ......