JavaScript¸ß¼¶³ÌÐòÉè¼Æѧϰ±Ê¼Ç2£º Ä£Ä⺯ÊýÖØÔØ
ÓÃarguments¶ÔÏó¼ì²â´«µÝ¸øº¯ÊýµÄ²ÎÊý¸öÊý£ºarguments.length
function test(){
if(arguments.length == 1)
alert(arguments[0] + "£¬ÄãºÃ");
else if(arguments.length == 2)
alert(arguments[0] + "," + arguments[1] + "£¬ÄãÃǺÃ")
else
alert("´ó¼ÒºÃ");
}
test(); //Êä³ö: ´ó¼ÒºÃ
test("a"); //Êä³ö: a£¬ÄãºÃ
test("a","b"); //Êä³ö: a,b,ÄãÃǺÃ
test("a","b","c","d"); //Êä³ö: ´ó¼ÒºÃ
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
´úÂëʾÀý
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<mce:style><!--
.man{ float:left; background:#9af; margin:3px; padding:3px; cursor:default}
--></mce:style>< ......
flex ºÍjavascript»¥Ïàµ÷Óá£
Ò»¡¢flex µ÷ÓÃjavascript
Ö»ÐèʹÓþ²Ì¬µÄExternalInterface.call¾Í¿ÉÒÔÁË¡£
call ·½·¨ÖÁÉÙÒªÇóÒ»¸ö²ÎÊý£¬¾ÍËùµ÷ÓöÊýµÄÃû³Æ¡£
Ò²¿ÉÒÔ´«µÝ²ÎÊý¡£
È磺
ExternalInterface.call("alert","hello");
"hello"¾ÍÊÇ×÷Ϊalertµ ......
javascript parseInt is broken
I was debugging some strange errors in a date conversion function I was writing, and I stumbled upon something that amazed me... a strange bug in parseInt
>>>parseInt('06')
6
>>>parseInt('07')
7
>>>parseInt('08')
0
>>>parseInt ......