ÃæÏò¶ÔÏóµÄJavaScriptµÄ±í¸ñÅÅÐòÎÊÌâ
JavaScript±í¸ñÅÅÐòÓкܶàÖÖ·½Ê½£¬²»¹ýÔÚʹÓÃÃæÏò¶ÔÏóµÄ·½Ê½½øÐÐJavaScriptÅÅÐòʱIE»áÓÐһЩÎÊÌâ¡£´úÂëÈçÏ£º
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ÑÝʾ±í¸ñµÄÅÅÐò¹¦ÄÜ</title>
</head>
<script type="text/javascript">
var previousColumnIndex = 0;
ArrayUtil = {
arrayOne: [3, 32, 2, 5],
arrayTwo: ["3","32","2","5"],
demoNoarmal: function(){
this.arrayOne.sort();//ĬÈÏ·½Ê½ÅÅÐò
alert(this.arrayOne);
},
comparionAsc: function(one, two){ //ÉýÐò
if(one < two){
return -1;
}else if(one > two){
return 1;
}else{
return 0;
}
},
comparionDesc: function(one, two){ //½µÉý
if(one < two){
return 1;
}else if(one > two){
return -1;
}else{
return 0;
}
},
comparionSort: function(){
//this.arrayOne.sort(this.comparionAsc);
this.arrayOne.sort(this.comparionDesc);
alert(this.arrayOne);
},
comparionAscForString: function(one, two){
//return one.localeCompare(two); //ÉýÐò
return -one.localeCompare(two); //½µÐò
},
comparionString: function(){
this.arrayTwo.sort(this.comparionAscForString);
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐĿǰ¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×î¶¥¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×î¶¥¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
ÔÎÄ£ºJavaScript - The this keyword
ÔÚ JavaScript ÖÐ this ÊÇ×îÇ¿µÄ¹Ø¼ü×ÖÖ®Ò»¡£ÕâÆªÌùÎľÍÊÇÒª¸æËßÄãÈçºÎÓúà this¡£
ÏÂÃæÏȽ²ÈçºÎÔÚevent handling
(ʼþ´¦Àí)ÖÐÓÃËü£¬ÔÙ½Ó×ÅÊǽ² this µÄÆäËûÓ÷¨¡£
ËùÓÐÕß(Owner)
ÏÈÀ´¿´¿´º¯Êý doSomething() ÀïµÄ this ¾¿¾¹Ö¸Ïò(refer to)ÁËʲô£¿
function doSomething() { ......
<!---------<html>
<head>
<style type="text/css">
.tabheader table {
border-collapse: collapse; /* for IE */
border-spacing: 0; /* for N6 */
}
.tabheader table tr td {mar ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>ÍøÒ³¼ÆËãÆ ......
JavaScriptÖеÄÔÐÍ(prototyping) prototypeÊôÐÔ
1.¶ÔÄÚÖöÔÏóµÄÀ©Õ¹
(StringÌí¼Ótrim()·½·¨)
****************
String.prototype.trim = funct ......