ÔÚjavascriptÖлñÈ¡ÖÐÓ¢ÎÄ×Ö·û³¤¶ÈµÄÎÊÌâ
ÔÚjavascriptÖлñÈ¡ÖÐÓ¢ÎÄ×Ö·û³¤¶ÈµÄÎÊÌâ
var i="Öйúa";
Ò»°ãÇé¿öÏ£¬ÎÒÃÇÓÃi.length»áµÃµ½½á¹û3
µ«ÓÐʱºòÎÒÃÇÐèÒª5£¬ÏÂÃæµÄС´úÂë¿ÉÒÔ½â¾öÎÊÌâ
Java´úÂë
1. <script>
2. alert (fucCheckLength("Öйúaaaa"));
3. function fucCheckLength(strTemp)
4. {
5. var i,sum;
6. sum=0;
7. for(i=0;i<strTemp.length;i++)
8. {
9. if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
10. sum=sum+1;
11. else
12. sum=sum+2;
13. }
14. return sum;
15. }
16. </script>
Ïà¹ØÎĵµ£º
response.write "<script language='javascript'>"
response.write "alert('Óû§Ãû»òÃÜÂë´íÎó!');"
response.write "hist ......
ÒýÑÔ
ÔÚJavaScriptÖÐÎÒÃÇʹÓÃÁËÒ»ÖÖ±»³ÆΪ JavaScript Object Notation(ËõдJSON)µÄÐÎʽ£¬·ÒëΪÖÐÎľÍÊÇ“JavaScript¶ÔÏó±íʾ·¨”¡£Ëü¿ÉÒÔ¼ò½éÇåÎúµØ½«¶ÔÏóµÄ½á¹¹ÃèÊö³öÀ´£¬´Ó¶ø´ó´ó½µµÍÁËÎÒÃǵŤ×÷Á¿²¢¼õÉÙÁËÊý¾ÝÁ¿¡£
JsonʾÀý
<script languag ......
ÒýÑÔ
³ýJSONÍ⣬ÔÚJavaScriptÖÐÎÒÃÇ¿ÉÒÔʹÓÃnew²Ù×÷·û½áºÏÒ»¸öº¯ÊýµÄÐÎʽÀ´´´½¨¶ÔÏó¡£ÀýÈ磺
function MyFunc() {}; //¶¨ÒåÒ»¸ö¿Õº¯Êý
var anObj = new MyFunc(); //ʹÓà new ²Ù×÷·û£¬½èÖú MyFun º¯Êý£¬¾Í´´½¨Á ......
ÎÒÃǶ¼ÖªµÀjava¡¢c#¡¢vbµÈÓïÑÔ¶¼ÓÐsleepÔÝÍ£µÄº¯Êý£¬¶øJavaScript½Å±¾Ã»ÓÐÀàËƵŦÄÜ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄʵÏֵķ½·¨£º
<mce:script type="text/javascript"><!--
function test()
{
var s="javascript--ÔÝÍ£º¯Êý";
setTimeout(
function(){
eval(sleep(test)); //Ö´ÐÐreturnÖ®ºóµÄ´úÂ룬Ҳ¾ÍÊÇ&ldq ......
ÔÎĵØÖ·£ºhttp://developer.51cto.com/art/201002/185161.htm
JavaScriptÊÇÒ»Öֹ㷺ÓÃÓÚ¿Í»§¶ËWeb¿ª·¢µÄ½Å±¾ÓïÑÔ£¬Æä¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±»Web¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇDOM API£¬Ò²Ôø¾ÓÐÈËÈÏΪJavaScriptÓï·¨ÖÐÓкܶàÏÝÚ壬ͬʱÆäÒ²ÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔJavaÃüÃû£¬µ«²¢ ......