Èç¹ûΪabsoluteÉèÖÃÁËtop¡¢left£¬absoluteÔªËØ»á¸ù¾Ý×î½üµÄ¶¨Î»ÉÏÏÂÎÄÈ·¶¨Î»Öã¬ä¯ÀÀÆ÷»áµÝ¹é²éÕÒ¸ÃÔªËصÄËùÓи¸ÔªËØ£¬Èç¹ûÕÒµ½Ò»¸öÉèÖÃÁËposition:relative/absolute/fixedµÄÔªËØ£¬¾ÍÒÔ¸ÃÔªËØΪ»ù×¼¶¨Î»£¬Èç¹ûûÕÒµ½£¬¾ÍÒÔä¯ÀÀÆ÷±ß½ç¶¨Î»¡£
Èý£ºfixedÆäʵfixedºÍabsoluteÊÇÒ»ÑùµÄ£¬Î¨Ò»µÄÇø±ðÔÚÓÚ£ºabsoluteÔªËØÊǸù¾Ý×î½üµÄ¶¨Î»ÉÏÏÂÎÄÈ·¶¨Î»Ö㬶øfixedÓÀÔ¶¸ù¾Ýä¯ÀÀÆ÷È·¶¨Î»ÖÃ.
11.ÈçºÎ¾ÓÖÐÒ»¸öfloat:leftµÄÔªËØÖ÷Ҫ˼·ÈçÏ£º
1.¶¨Ò常¼¶ÔªËØΪÐм¶ÔªËØ£¬ÔÚ¸¸¼¶ÔªËØÖ®ÉÏÉ趨text-align:center
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Document</title>
</head>
<body >
<div style=”text-align: center;”>
<div style=”display: inline-block;”>
<div style=”float:left;background: green;”>
×ÓÔªËØ1
</div>
<div style=”float:left;background: blue;”>
×ÓÔªËØ2
</div>
</div>
</div>
</body>
</html>
2.¸¸ÔªËظ¡¶¯·¨
ÔÚÍâ²ã°ü¹üÒ»¸ö¸¸ÔªËØ£¬Ê¹Ëû¸¡¶¯£¬Ïà¶Ô¶¨Î»,left:50%£»ÄÚ²¿ÔªËØͬÑùÏà¶Ô¶¨Î»£¬left:-50%£»
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Document</title>
</head>
<body >
<div style=”float:left;position:relative;left:50%;”>
<div style=”float:left;left: -50%;background: green;”>
×ÓÔªËØ1
</div>
<div style=”float:left;background: blue;”>
×ÓÔªËØ2
</div>
</div>
</body>
</html>
12.CssÔÚ¸÷ä¯ÀÀÆ÷ϵļæÈÝÎÊÌâÄãͨ³£ÊÇÔõôÀ´½â¾öµÄ£¬Çë·ÖÏíÄãµÄ¾Ñ飻½â¾ö°ì·¨Ò»°ã¶¼ÊÇƽʱΪ֪±Ê¼Ç¼Ç¼£¬ËÑË÷ʱÊìϤÄÚÈÝÕұʼÇÄÚÈÝ+²»ÊìϤµÄÕҹȸ衣
¶þ.JS²¿·Ö 1.parseInt Óë parseFloat µÄÇø±ð£¿parseInt Óë parseFloat ÊÇ°Ñ×Ö·û´®×ª»»³ÉÕûÊýºÍ¸¡µãÊýµÄ·½·¨£¬
¶þÕßÓï·¨ÈçÏÂ
parseInt(string, radix)
parseFloat(string)
parseInt¶àÒ»¸ö¿ÉÑ¡µÄradixÊý×Ö»ùÊý¡£
Á½ÕßµÄһЩ²ÎÊýÖ´Ðзµ»Ø½á¹ûÈçÏÂ
strparseInt(str)parseFloat(str)
Á㳤¶È×Ö·û´® NaN NaN
null NaN NaN
undefined NaN NaN
.3 0 0.3
-.3 NaN -0.3
-3 -3 -3
3e7 3 30000000
0xFF 255 0
0x3e7 999 0
08 8 8
3 3 3
123abc 123 123
2.valueof Óë toString µÄÇø±ð£¿»ù±¾ÉÏ£¬ËùÓеÄJSÊý¾ÝÀàÐͶ¼ÓµÓÐÕâÁ½ÖÖ·½·¨(NULL³ýÍâ)£¬ËûÃÇÁ©½â¾öÁËJSÖµµÄÔËËãºÍÏÔʾÎÊÌâ¡£
ÔÚ¡¶javaScript¡¡¸ß¼¶³ÌÐòÉè¼Æ¡·Ò»ÊéÖÐÃèÊöÈçÏ£º
toString()——·µ»Ø¶ÔÏóµÄÔʼ×Ö·û´®±íʾ
valueOf()——·µ»Ø×îÊʺϸöÔÏóµÄÔʼֵ
Ò»¸öÀý×Ó£º
<script>
function Money(gold, silver, coin)
{
this.gold = gold;
this.silver = silver;
this.coin = coin;
}
Money.parse = function(value)
{
var coin = parseInt(value % 25);
var silver = parseInt(value / 25 % 20);
var gold = parseInt(value / 500);
return new Money(gold, silver, coin);
}
Money.prototype.valueOf = function( )
{
return ((this.gold * 20) + this.silver) * 25 + this.coin;
}
Money.prototype.toString = function( )
{
return this.gold + “½ð£¬” + this.silver + “Òø£¬” + this.coin + “Í”;
}
var money1 = new Money(5, 6, 1);
var money2 = new Money(2, 4, 6);
var money3 = Money.parse(money1 + money2);
alert(money3);//7½ð£¬10Òø£¬7Í
</script>
ÕâÀïÒþʽµ÷ÓÃÁËvalueOf¸útoString£¬¶þÕß²¢´æµÄÇé¿öÏ£¬ÔÚÊýÖµÔËËãÖУ¬ÓÅÏȵ÷ÓÃÁËvalueOf£¬×Ö·û´®ÔËËãÖУ¬ÓÅÏȵ÷ÓÃÁËtoString¡£±ÈÈçmoney1 + money2£¬µ÷ÓõľÍÊÇÁ½ÕßvalueOfÖ®ºóµÄÖµÏà¼Ó£¬¶øalertµÄʱºò£¬°Ñmoney3ÏÈtoStringÁËһϡ£
strvalueOf(str)toString(str)
Array ArrayÊý×éµÄÔªËر»×ª»»Îª×Ö·û´®£¬ÕâЩ×Ö·û´®ÓɶººÅ·Ö¸ô£¬Á¬½ÓÔÚÒ»Æð¡£Æä²Ù×÷Óë Array.toString ºÍ Array.join ·½·¨Ïàͬ¡£ Array½« Array µÄÔªËØת»»Îª×Ö·û´®¡£½á¹û×Ö·û´®ÓɶººÅ·Ö¸ô£¬ÇÒÁ¬½ÓÆðÀ´¡£
Boolean BooleanµÄÔʼֵ BooleanÈç¹û Boolean ÖµÊÇ true£¬Ôò·µ»Ø “true”¡£·ñÔò£¬·µ»Ø “false”¡£
Date Date´æ´¢µÄʱ¼äÊÇ´Ó 1970 Äê 1 Ô 1 ÈÕÎçÒ¹¿ªÊ¼¼ÆµÄºÁÃëÊý UTC¡£ Date·µ»ØÈÕÆÚµÄÎÄ×Ö±íʾ·¨¡£Error·µ»ØÒ»¸ö°üº¬Ïà¹Ø´íÎóÏûÏ¢µÄ×Ö·û´®¡£
Function Functionº¯Êý±¾Éí¡£ Function·µ»ØÈçϸñʽµÄ×Ö·û´®£¬ÆäÖÐ functionname ÊDZ»µ÷Óà toString ·½·¨º¯ÊýµÄÃû³Æ£º function functionname( ) { [native code] }
Number NumberÊý×ÖÖµ¡£ Number·µ»ØÊý×ÖµÄÎÄ×Ö±íʾ¡£
Object Object¶ÔÏó±¾Éí¡£ÕâÊÇĬÈÏÇé¿ö¡£ ObjectĬÈÏ·µ»Ø “[object objectname]”£¬ÆäÖÐ objectname ÊǶÔÏóÀàÐ͵ÄÃû³Æ¡£
String String×Ö·û´®Öµ¡£ String·µ»Ø String ¶ÔÏóµÄÖµ¡£
3.È«µÈÓëÏàµÈ£¿ÏàµÈ(==),µ±ÇÒ½öµ±Á½¸öÔËËã·ûÏàµÈʱ£¬·µ»Øtrue¡£ÔÚÈ·¶¨Á½¸öÔËËã·ûʱ»á½øÐÐÀàÐÍת»»¡£
Ö´ÐÐÀàÐÍת»»µÄ¹æÔòÈçÏ£º
Èç¹ûÒ»¸öÔËËãÊýÊÇ Boolean Öµ£¬ÔÚ¼ì²éÏàµÈÐÔ֮ǰ£¬°ÑËüת»»³ÉÊý×ÖÖµ¡£false ת»»³É 0£¬true Ϊ 1¡£
Èç¹ûÒ»¸öÔËËãÊýÊÇ×Ö·û´®£¬ÁíÒ»¸öÊÇÊý×Ö£¬ÔÚ¼ì²éÏàµÈÐÔ֮ǰ£¬Òª³¢ÊÔ°Ñ×Ö·û´®×ª»»³ÉÊý×Ö¡£
Èç¹ûÒ»¸öÔËËãÊýÊǶÔÏó£¬ÁíÒ»¸öÊÇ×Ö·û´®£¬ÔÚ¼ì²éÏàµÈÐÔ֮ǰ£¬Òª³¢Ê԰ѶÔÏóת»»³É×Ö·û´®¡£
Èç¹ûÒ»¸öÔËËãÊýÊǶÔÏó£¬ÁíÒ»¸öÊÇÊý×Ö£¬ÔÚ¼ì²éÏàµÈÐÔ֮ǰ£¬Òª³¢Ê԰ѶÔÏóת»»³ÉÊý×Ö¡£
È«µÈ(===)
Ö»ÓÐÔÚÎÞÐèÀàÐÍת»»ÔËËãÊý¾ÍÏàµÈµÄÇé¿öÏ£¬²Å·µ»Ø true¡£
4.break Óë continue µÄÇø±ð£¿break±íʾÌø³öÑ»·£¬continue±íʾ½áÊø±¾´ÎÑ»·
5.jsµÄ×÷ÓÃÓò£¿jsµÄ×÷ÓÃÓòÒÔº¯ÊýfunctionÀ´»®·Ö£¬¸ù¾Ý×÷ÓÃÓò£¬Ê¹µÃ±äÁ¿´æÔÚ×÷ÓÃÓòµÄ¸ÅÄî·ÖΪȫ¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿¡£
6.Array µÄ slice Óë splice µÄÇø±ð£¿arrayObject.slice(start,end)
¡¡