Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScript ×Ö·û´®×ª»»Êý×Ö(תÔØ)

JavaScript ×Ö·û´®×ª»»Êý×Ö(תÔØ)
·½·¨Ö÷ÒªÓÐÈýÖÖ
ת»»º¯Êý¡¢Ç¿ÖÆÀàÐÍת»»¡¢ÀûÓÃjs±äÁ¿ÈõÀàÐÍת»»¡£
1. ת»»º¯Êý
jsÌṩÁËparseInt()ºÍparseFloat()Á½¸öת»»º¯Êý¡£Ç°Õß°Ñֵת»»³ÉÕûÊý£¬ºóÕß°Ñֵת»»³É¸¡µãÊý¡£Ö»ÓжÔStringÀàÐ͵÷ÓÃÕâЩ·½·¨£¬ÕâÁ½¸öº¯Êý²ÅÄÜÕýÈ·ÔËÐУ»¶ÔÆäËûÀàÐÍ·µ»ØµÄ¶¼ÊÇNaN(Not a Number)¡£
ÔÚÅжÏ×Ö·û´®ÊÇ·ñÊÇÊý×Öֵǰ£¬parseInt()ºÍparseFloat()¶¼»á×Ðϸ·ÖÎö¸Ã×Ö·û´®¡£parseInt()·½·¨Ê×ÏȲ鿴λÖÃ0´¦µÄ×Ö·û£¬ÅжÏËüÊÇ·ñÊǸöÓÐЧÊý×Ö£»Èç¹û²»ÊÇ£¬¸Ã·½·¨½«·µ»ØNaN£¬²»ÔÙ¼ÌÐøÖ´ÐÐÆäËû²Ù×÷¡£µ«Èç¹û¸Ã×Ö·ûÊÇÓÐЧÊý×Ö£¬¸Ã·½·¨½«²é¿´Î»ÖÃ1´¦µÄ×Ö·û£¬½øÐÐͬÑùµÄ²âÊÔ¡£ÕâÒ»¹ý³Ì½«³ÖÐøµ½·¢ÏÖ·ÇÓÐЧÊý×ÖµÄ×Ö·ûΪֹ£¬´ËʱparseInt()½«°Ñ¸Ã×Ö·û֮ǰµÄ×Ö·û´®×ª»»³ÉÊý×Ö¡£
ÀýÈ磬Èç¹ûÒª°Ñ×Ö·û´® "1234blue "ת»»³ÉÕûÊý£¬ÄÇôparseInt()½«·µ»Ø1234£¬ÒòΪµ±Ëü¼ì²âµ½×Ö·ûbʱ£¬¾Í»áÍ£Ö¹¼ì²â¹ý³Ì¡£×Ö·û´®Öаüº¬µÄÊý×Ö×ÖÃæÁ¿»á±»Õýȷת»»ÎªÊý×Ö£¬Òò´Ë×Ö·û´® "0xA "»á±»Õýȷת»»ÎªÊý×Ö10¡£²»¹ý£¬×Ö·û´® "22.5 "½«±»×ª»»³É22£¬ÒòΪ¶ÔÓÚÕûÊýÀ´Ëµ£¬Ð¡ÊýµãÊÇÎÞЧ×Ö·û¡£Ò»Ð©Ê¾ÀýÈçÏ£º
parseInt("1234blue");   //returns   1234
parseInt("0xA");   //returns   10
parseInt("22.5");   //returns   22
parseInt("blue");   //returns   NaN
parseInt()·½·¨»¹Óлùģʽ£¬¿ÉÒ԰Ѷþ½øÖÆ¡¢°Ë½øÖÆ¡¢Ê®Áù½øÖÆ»òÆäËûÈκνøÖƵÄ×Ö·û´®×ª»»³ÉÕûÊý¡£»ùÊÇÓÉparseInt()·½·¨µÄµÚ¶þ¸ö²ÎÊýÖ¸¶¨µÄ£¬ËùÒÔÒª½âÎöÊ®Áù½øÖƵÄÖµ£¬ÐèÈçϵ÷ÓÃparseInt()·½·¨£º
parseInt("AF",   16);   //returns   175
µ±È»£¬¶Ô¶þ½øÖÆ¡¢°Ë½øÖÆ£¬ÉõÖÁÊ®½øÖÆ£¨Ä¬ÈÏģʽ£©£¬¶¼¿ÉÒÔÕâÑùµ÷ÓÃparseInt()·½·¨£º
parseInt("10",   2);   //returns   2
parseInt("10",   8);   //returns   8
parseInt("10",   10);   //returns   10
Èç¹ûÊ®½øÖÆÊý°üº¬Ç°µ¼0£¬ÄÇô×îºÃ²ÉÓûùÊý10£¬ÕâÑù²Å²»»áÒâÍâµØµÃµ½°Ë½øÖƵÄÖµ¡£ÀýÈ磺
parseInt("010");   //returns   8
parseInt("010",   8);   //returns   8
parseInt("010",   10);   //returns   10
ÔÚÕâ¶Î´úÂëÖУ¬Á½ÐдúÂ붼°Ñ×Ö·û´


Ïà¹ØÎĵµ£º

jLayout — JavaScript Layout Algorithms


The jLayout JavaScript library provides layout algorithms for laying out components. A component is an abstraction; it can be implemented in many ways, for example as items in a HTML5 Canvas drawing or as HTML elements. The jLayout library allows you to focus on drawing the individual components i ......

Javascript ʹÓÃIDE¹¤¾ß½øÐе÷ÊÔ

1. Javascript Debug Toolkit½éÉÜ
JSDT(Javascript Debug Toolkit)ÊÇÒ»¸öÓÃÓÚjavascriptµ÷ÊÔµÄeclipse
²å¼þ£¬ÓÃÓÚµ÷ÊÔjavascript¡£JSDT¿ÉÒÔ¿çä¯ÀÀÆ÷µ÷ÊÔ£¬Ö§³ÖÔÚIE,Firefox,Safari,ChromeµÈÖ÷Á÷ä¯ÀÀÆ÷Öе÷ÊÔ
javascript¡£JSDTÖ§³ÖÉèÖöϵ㣬µ¥²½µ÷ÊԵȵ÷ÊÔ¹¤¾ßµÄ»ù±¾ÌØÐÔ¡£
2. ÈçºÎ°²×°
JSDTÊÇ»ùÓÚeclipse3.2+,jdk1.5+ ......

JavaScript¾­µäÓï¾ä¼°Æä»ù±¾Ó¦ÓÃ

¡ö´ò¿ª¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=´ò¿ª>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
¡öÁí´æΪ¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) typ ......

JavascriptÁ·Ï°ÊµÀý01:³Ë·¨¿Ú¾÷±íÓëɸѡËØÊý

<html>
<body>
<mce:script type="text/javascript"><!--
document.write("<table border=1px>");
for(i=1;i<=9;i++)
{document.write("<tr>");
for (j=1;j<=i;j++)
{document.write("<td class='table1'>"+i+"*"+j+"="+i*j+"&nbsp;&nbsp;& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ