javascript ѧϰ±Ê¼Ç£¨2£©
1. BooleanÖµ¡¢Êý×Ö¡¢×Ö·û´®µÄÔʼֵÊÇα¶ÔÏó£¬ÕâÒâζ×ÅËûÃǾßÓÐÊôÐԺͷ½·¨¡£
var test = "hello";
alert(test.length); //outputs "5"
2. javascript Ëù¶¨ÒåµÄËùÓжÔÏó¶¼ÓÐ toString() ·½·¨£¬²»¹ÜÊÇα¶ÔÏó»¹ÊÇÕæµÄ¶ÔÏó£¬Boolean µÄ toString() ·½·¨Ö»·µ»Ø “true” »òÕß“false”¡£
var test = false;
alert(test.toString()); //outputs "false"
3. parseInt() ºÍ parseFloat()
alert(parseInt("1234test")); //outputs "1234"
alert(parseInt("0xA")); //outputs "10"
alert(parseInt("22.1")); //outputs "22"
alert(parseInt("test")); //outputs "NaN"
4. String() ºÍ toString() ΨһµÄÇø±ðÔÚÓÚ¶Ô null »òÕß undefined ÖµµÄÇ¿ÖÆת»»ÉÏ¡£
var test = String(null) //"null"
var test1 = null;
var test2 = test1.toString(); //»á²úÉú´íÎó
5. Object “Àà”¡£
¾ßÓÐÒÔÏÂÊôÐÔ
Constructor---¶Ô´´½¨¶ÔÏóµÄº¯ÊýµÄÒýÓã¨Ö¸Õ룩¡£¶ÔÓÚ Object Àà¸ÃÖ¸ÕëÖ¸ÏòÔʼµÄ Object() º¯Êý¡£
Prototype---¶Ô¸Ã¶ÔÏóµÄ¶ÔÏóÔÐ͵ÄÒýÓá£
¾ßÓÐÒÔÏ·½·¨
HasOwnProperty(property)---Åж϶ÔÏóÊÇ·ñÓÐÌض¨µÄÊôÐÔ¡£
IsPrototypeOf---ÅжϸöÔÏóÊÇ·ñΪÁíÒ»¸ö¶ÔÏóµÄÔÐÍ¡£
PropertyIsEnumerable---Åжϸø¶¨µÄÊôÐÔÊÇ·ñ¿ÉÒÔÓÃfor...inÓï¾ä½øÐÐö¾Ù¡£
toString()---·µ»Ø¶ÔÏóµÄÔʼ×Ö·û´®±íʾ¡£
ValueOf()---·µ»Ø×îÊʺϸöÔÏóµÄÔʼֵ¡£
Ïà¹ØÎĵµ£º
Ò»¡¢document.formName.item(“itemName”) ÎÊÌâ
ÎÊÌâ˵Ã÷£ºIEÏ£¬¿ÉÒÔʹÓà document.formName.item(“itemName”) »ò document.formName.elements ["elementName"]£»FirefoxÏ£¬Ö»ÄÜʹÓÃdocument.formName.elements["elementName"]¡£
½â¾ö·½·¨£ºÍ³Ò»Ê¹ÓÃdocument.formName.elements["elementName" ......
ÓÃÁ˺ܾÃJavaScript£¬¶Ô¡¾this¡¿µÄÈÏʶֻ¾ÖÏÞÓÚÒÔÍùµÄƾ¾Ñé¶øÒÑ£¬²»¹ý½ñÌì·¢ÏÖÁ˺ö«Î÷“http://www.quirksmode.org/js/associative.html”£¬ÏêϸÃèÊöÁËÈçºÎʹÓá¾this¡¿¹Ø¼ü×Ö£¬ÔÚÕâÀïÎҾͼò¶ÌµÄ˵һÏÂÖص㣬Èç¹ûÓÐÒÉÎÊ¿ÉÒÔÖ±½Ó²Î¿¼ÔÎÄ¡£
ÔÚѧϰ¹ýÓÐthisµÄ±à³ÌÓïÑÔÖУ¬thisÒ»°ã¶¼ÊÇÖ¸Ïòµ±Ç°ÊµÀý¶ÔÏóµÄ£¬¶ÔÓ ......
ת×Ô£º
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ͼƬÅÜÂíµÆ</title>
</head>
<body>
<div style="overflow:hidden; width:350px" id='div'>
<!-- ÕâÀïÊǵÚÒ»¸ö¹Ø¼üµã£¬o ......
µÚÈýÕÂ ¶ÔÏó»ù´¡
ÔÚjavaScriptÖУ¬¶ÔÏóÊÇÎÞÌض¨Ë³ÐòµÄÖµµÄÊý×é¡£
Ò»¡¢¶ÔÏóµÄÀàÐÍ
·ÖΪ±¾µØ¶ÔÏó¡¢ÄÚÖöÔÏóºÍËÞÖ÷¶ÔÏóÈýÖÖ£¬ÆäÖÐÄÚÖöÔÏóÒ²ÊôÓÚ±¾µØ¶ÔÏó¡£
¶þ¡¢±¾µØ¶ÔÏó£º
1¡¢ArrayÀ࣬Êý×éÀà¡£
  ......
JavaScriptÖÐtoGMTStringº¯Êý·½·¨ÊÇ·µ»ØÒ»¸öÈÕÆÚ£¬¸ÃÈÕÆÚÓøñÁÖÍþÖαê׼ʱ¼ä (GMT) ±íʾ²¢Òѱ»×ª»»Îª×Ö·û´®¡£Ê¹Ó÷½·¨£º
dateObj .toGMTString()
JavaScriptÖÐtoGMTStringº¯Êý·½·¨ÒѾ¹ýʱ£¬Ö®ËùÒÔÈÔÈ»ÌṩÕâ¸ö·½·¨£¬Ö»ÊÇΪÁËÌṩÏòºóµÄ¼æÈÝÐÔ¡£ÍƼö¸ÄÓà toUTCString ·½·¨¡£
toGMTString ·½·¨·µ»ØÒ»¸ö String ¶ÔÏó£¬´Ë ......