Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScript±í¸ñÅÅÐò

 ´ËÀý×ÓÊÇjavascript¸ß¼¶³ÌÐòÉè¼ÆÀïµÄ
·Å³öÀ´Ðı¸ÒÔºóʹÓá£ÉÏ´úÂë¡£
<html>
<head>
<title>Table Sort Example</title>
<mce:script type="text/javascript"><!--

function convert(sValue, sDataType) {
switch(sDataType) {
case "int":
return parseInt(sValue);
case "float":
return parseFloat(sValue);
case "date":
return new Date(Date.parse(sValue));
default:
return sValue.toString();

}
}

function generateCompareTRs(iCol, sDataType) {

return function compareTRs(oTR1, oTR2) {
var vValue1, vValue2;

if (oTR1.cells[iCol].getAttribute("value")) {
vValue1 = convert(oTR1.cells[iCol].getAttribute("value"),
sDataType);
vValue2 = convert(oTR2.cells[iCol].getAttribute("value"),
sDataType);
} else {
vValue1 = convert(oTR1.cells[iCol].firstChild.nodeValue,
sDataType);
vValue2 = convert(oTR2.cells[iCol].firstChild.nodeValue,
sDataType);
}

if (vValue1 < vValue2) {
return -1;
} else if (vValue1 > vValue2) {
return 1;
} else {


Ïà¹ØÎĵµ£º

JavaScript »ñÈ¡¶ÔÏóµÄ¸ß¶ÈºÍ¿í¶ÈÏêϸ˵Ã÷

scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......

javascriptµÄOO¼Ì³Ð


ÔÚprototype¿ò¼ÜÖеÄÀà¼Ì³ÐʵÏÖ»úÖÆ
//ΪObjectÀàÌí¼Ó¾²Ì¬·½·¨£ºextend
Object.extend = function(destination, source) {
  for(property in source) {
     destination[property] = source[property];
  }
  return destination;
}
//ͨ¹ýObjectÀàΪÿ¸ö¶ÔÏóÌí¼Ó·½·¨ ......

Javascript¿çÓò·ÃÎʽâ¾ö·½°¸¡¾×ªÌû¡¿

ÓÉÓÚ°²È«·½ÃæµÄ¿¼ÂÇ£¬Javascript±»ÏÞÖÆÁË¿çÓò·ÃÎʵÄÄÜÁ¦£¬µ«ÊÇÓÐʱºòÎÒÃÇÏ£ÍûÄܹ»×öһЩºÏÀíµÄ¿çÓò·ÃÎʵÄÊÂÇ飬ÄÇôÔõô°ìÄØ£¿
ÕâÀï·ÖÁ½ÀàÇé¿ö£º
Ò»¡¢»ùÓÚͬһ¸¸ÓòµÄ×ÓÓòÖ®¼äÒ³ÃæµÄ·ÃÎÊ£»²Î¼ûÈçÏÂ3¸ödomainÓò£ºtaobao.com¡¢jipiao.taobao.com¡¢promotion.taobao.com£»ËüÃÇÓÐÏàͬµÄ¸¸Óòtaobao.com¡£
¶þ¡¢»ùÓÚ²»Í¬¸¸ÓòÒ³Ãæ ......

JavascriptÖÐEventÊôÐԺͷ½·¨

 EventÊôÐԺͷ½·¨£º
1. type£ºÊ¼þµÄÀàÐÍ£¬ÈçonlickÖеÄclick£»
2. srcElement/target£ºÊ¼þÔ´£¬¾ÍÊÇ·¢ÉúʼþµÄÔªËØ£»
3. button£ºÉùÃ÷±»°´ÏµÄÊó±ê¼ü£¬ÕûÊý£¬1´ú±í×ó¼ü£¬2´ú±íÓÒ¼ü£¬4´ú±íÖмü£¬Èç¹û°´Ï¶à¸ö¼ü£¬¾Æ°ÑÕâЩֵ¼ÓÆðÀ´£¬ËùÒÔ3¾Í´ú±í×óÓÒ¼üͬʱ°´Ï£»£¨firefoxÖÐ 0´ú±í×ó¼ü£¬1´ú±íÖмä¼ü£¬2´ú±íÓÒ¼ü£© ......

ת£ºÎò͸JavaScript

żµÃ±¾ÄÚÈÝ£¬¸Ð¾õдµÃºÜÊDz»´í£¬ÌØתÀ´Óë´ó¼Ò·ÖÏí
Èí¼þ˼Ï뾫ƷϵÁÐ
Îò͸ JavaScript
Ô­Öø£ºÀîÕ½(leadzen)
http://www.cndev.org
http://www.cnblogs.com/leadzen
1
Òý×Ó
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵľÀ²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»î
Á¦¡£
Êý¾ÝÌìÉú¾ÍÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ