JavaScriptÖÐʹÓÃÔÐÍÀ´´´½¨¶ÔÏó
ÔÚ±àд¹¹Ô캯Êýʱ£¬¿ÉÒÔʹÓÃÔÐͶÔÏó£¨Ëü±¾ÉíÊÇËùÓй¹Ô캯ÊýµÄÒ»¸öÊôÐÔ£©µÄÊôÐÔÀ´´´½¨¼Ì³ÐÊôÐԺ͹²Ïí·½·¨¡£ÔÐÍÊôÐԺͷ½·¨½«°´ÒýÓø´ÖƸøÀàÖеÄÿ¸ö¶ÔÏó£¬Òò´ËËüÃǶ¼¾ßÓÐÏàͬµÄÖµ¡£¿ÉÒÔÔÚÒ»¸ö¶ÔÏóÖиü¸ÄÔÐÍÊôÐÔµÄÖµ£¬ÐµÄÖµ½«¸²¸ÇĬÈÏÖµ£¬µ«½öÔÚ¸ÃʵÀýÖÐÓÐЧ¡£ÊôÓÚÕâ¸öÀàµÄÆäËû¶ÔÏó²»Êܴ˸ü¸ÄµÄÓ°Ïì¡£ÏÂÃæ¸ø³öÁËʹÓÃ×Ô¶¨Òå¹¹Ô캯ÊýµÄʾÀý£¬Circle£¨×¢Òâ this ¹Ø¼ü×ÖµÄʹÓã©¡£
Circle.prototype.pi = Math.PI;
function ACirclesArea () {
return this.pi * this.r * this.r; // ¼ÆËãÔ²Ãæ»ýµÄ¹«Ê½Îª ?r2¡£
}
Circle.prototype.area = ACirclesArea; // ¼ÆËãÔ²Ãæ»ýµÄº¯ÊýÏÖÔÚÊÇ Circle Prototype ¶ÔÏóµÄÒ»¸ö·½·¨¡£
var a = ACircle.area(); // ´ËΪÈçºÎÔÚ Circle ¶ÔÏóÉϵ÷ÓÃÃæ»ýº¯Êý¡£
ʹÓÃÕâ¸öÔÔò£¬¿ÉÒÔ¸øÔ¤¶¨ÒåµÄ¹¹Ô캯Êý£¨¶¼¾ßÓÐÔÐͶÔÏ󣩶¨Ò帽¼ÓÊôÐÔ¡£ÀýÈ磬Èç¹ûÏëÒªÄܹ»É¾³ý×Ö·û´®µÄÇ°ºó¿Õ¸ñ£¨Óë VBScript µÄ Trim º¯ÊýÀàËÆ£©£¬¾Í¿ÉÒÔ¸ø String ÔÐͶÔÏó´´½¨×Ô¼ºµÄ·½·¨¡£
// Ôö¼ÓÒ»¸öÃûΪ trim µÄº¯Êý×÷Ϊ
// String ¹¹Ô캯ÊýµÄÔÐͶÔÏóµÄÒ»¸ö·½·¨¡£
String.prototype.trim = function()
{
// ÓÃÕýÔò±í´ïʽ½«Ç°ºó¿Õ¸ñ
// ÓÿÕ×Ö·û´®Ìæ´ú¡£
return this.replace(/(^\s*)|(\s*$)/g, "");
}
// ÓпոñµÄ×Ö·û´®
var s = " leading and trailing spaces ";
// ÏÔʾ " leading and trailing spaces (35)"
window.alert(s + " (" + s.length + ")");
// ɾ³ýÇ°ºó¿Õ¸ñ
s = s.trim();
// ÏÔʾ"leading and trailing spaces (27)"
window.alert(s + " (" + s.length + ")");
Ïà¹ØÎĵµ£º
Document¶ÔÏóÄÚÈݼ¯ºÏ
document Îĵ²¶ÔÏó - JavaScript½Å±¾ÓïÑÔÃèÊö
———————————————————————
×¢:Ò³ÃæÉÏÔªËØnameÊôÐÔºÍJavaScriptÒýÓõÄÃû³Æ±ØÐëÒ»Ö°üÀ¨´óСд
·ñ ......
css:
1.
ul±êÇ©ÖÐFFÖÐÓиöpaddingÖµ£¬È´Ã»ÓÐmarginÖµ£¬¶øÔÚIEÖÐÕýºÃÏà·´
½â¾ö°ì·¨:½«ulµÄpaddingºÍmargin¶¼ÉèΪ0(Ò²¿ÉÒÔ²»ÊÇ0)È磺padding:0;margin:0;list-style:none;
ÁíÍâformĬÈÏÔÚIEÖÐÒ²»áÓÐmarginÖµ£¬ËùÒÔ×îºÃÒ²½«ÆämarginºÍpaddingÉèΪ0
2.   ......
//ÓÉÒ³ÃæÔªËØdate_string(YYYY-MM_DD¸ñʽ)µÃµ½Êý×édate_array
//ÊäÈë²ÎÊý£ºdate_string:ÈÕÆÚ´®£»marker:ÈÕÆÚ´®date_stringÀïµÄ·Ö¸ô·û£¬Èç¹ûûÓÐÔòΪ""£»
//·µ»ØÖµ£º Êý×飺date_array
// Êý×éÔªËØdate_array.year=YYYY£»dat ......
http://blog.csdn.net/cyai/archive/2009/05/25/4213956.aspx
JS×Ô´øº¯Êý
concat
½«Á½¸ö»ò¶à¸ö×Ö·ûµÄÎı¾×éºÏÆðÀ´£¬·µ»ØÒ»¸öеÄ×Ö·û´®¡£
var a = "hello";
var b = ",world";
var c = a.concat(b);
alert(c);
//c = "hello,world"
indexOf
·µ»Ø×Ö·û´®ÖÐÒ»¸ö×Ó´®µÚÒ»´¦³öÏÖµÄË÷Òý£¨´Ó×óµ½ÓÒËÑË÷£©¡£Èç¹ûÃ»Ó ......
javascript
ʼþÁбí½â˵
ʼþ
ä¯ÀÀÆ÷Ö§³Ö
½â˵
Ò»°ãʼþ
onclick
IE3¡¢N2
Êó±êµã»÷ʱ´¥·¢´Ëʼþ
ondblclick
IE4¡¢N4
Êó±êË«»÷ʱ´¥·¢´Ëʼþ
onmousedown
IE4¡¢N4
°´ÏÂÊó±êʱ´¥·¢´Ëʼþ
onmouseup
IE4¡¢N4
Êó±ê°´ÏºóËÉ¿ªÊó±êʱ´¥·¢´Ëʼþ
onmouseover
IE3¡¢N2
µ±Êó±êÒƶ¯µ½Ä³¶ÔÏ ......