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

Javascriptʱ¼ä²î¼ÆË㺯Êý

JavaScriptʱ¼ä²î¼ÆË㺯Êý
<mce:script language="javascript"><!--
Date.prototype.dateDiff = function(interval,objDate){
//Èô參數²»×ã»ò objDate ²»ÊÇÈÕÆÚÎï¼þ則»Ø傳 undefined
if(arguments.length<2||objDate.constructor!=Date) return undefined;
switch (interval) {
//計ËãÃë²î
case "s":return parseInt((objDate-this)/1000);
//計Ëã·Ö²î
case "n":return parseInt((objDate-this)/60000);
//計Ëã時²î
case "h":return parseInt((objDate-this)/3600000);
//計ËãÈÕ²î
case "d":return parseInt((objDate-this)/86400000);
//計Ëã週²î
case "w":return parseInt((objDate-this)/(86400000*7));
//計ËãÔ²î
case "m":return (objDate.getMonth()+1)+((objDate.getFullYear()-this.getFullYear())*12)-(this.getMonth()+1);
//計ËãÄê²î
case "y":return objDate.getFullYear()-this.getFullYear();
//輸ÈëÓÐ誤
default:return undefined;
}
}
// --></mce:script>
ºô½Ð´Ë·½·¨µÄ範ÀýÈçÏÂ:
<mce:script language="javascript"><!--
var sDT = new Date("2004/05/20 07:30:00");
var eDT = new Date("2005/05/20 08:32:02");
document.writeln("Ãë²î : "+sDT.dateDiff("s",eDT)+"<br>");
document.writeln("·Ö²î : "+sDT.dateDiff("n",eDT)+"<br>");
document.writeln("時²î : "+sDT.dateDiff("h",eDT)+"<br>");
document.writeln("ÈÕ²î : "+sDT.dateDiff("d",eDT)+"<br>");
document.writeln("週²î : "+sDT.dateDiff("w",eDT)+"<br>");
document.writeln("Ô²î : "+sDT.dateDiff("m",eDT)+"<br>");
document.writeln("Äê²î : "+sDT.dateDiff("y",eDT)+"&l


Ïà¹ØÎĵµ£º

JavaScript¾«´â¶ÁÊé±Ê¼Ç(6)

http://blog.csdn.net/mouyong/archive/2010/01/25/5252558.aspx
µÚ6Õ  Êý×é
Êý×éÊÇÒ»¶ÎÏßÐÔ·ÖÅäµÄÄڴ棬Ëüͨ¹ýÕûÊýÈ¥¼ÆËãÆ«ÒƲ¢·ÃÎÊÆäÖеÄÔªËØ¡£Êý×é¿ÉÒÔÊǺܿìµÄÊý¾Ý½á¹¹¡£²»ÐÒµÄÊÇ£¬JavaScriptµÄÊý×é²»ÊÇÕâÑùµÄ¡£ËüÌṩÁËÒ»ÖÖÓµÓÐÀàËÆÊý×éÌØÐԵĶÔÏó¡£Ëü°ÑÊý×éµÄϱêת±ä³É×Ö·û´®£¬ÓÃÆä×÷ΪÊôÐÔ¡£ËüÃ÷ÏԵر ......

JavaScript¾«´â¶ÁÊé±Ê¼Ç(8)

http://blog.csdn.net/mouyong/archive/2010/02/26/5329773.aspx
µÚ8Õ  ·½·¨
JavaScript°üº¬ÁËÉÙÁ¿¿ÉÓÃÔÚ±ê×¼ÀàÐÍÉϵıê×¼·½·¨¡£
Array
array.concat(item…)
concat·½·¨·µ»ØÒ»¸öÐÂÊý×飬Ëü°üº¬arrayµÄdz¸´ÖÆ(shallow copy)²¢½«1¸ö»ò¶à¸ö²ÎÊýitem¸½¼ÓÔÚÆäºó¡£Èç¹û²ÎÊýitemÊÇÒ»¸öÊý×飬ÄÇôËüµÄÿ¸öÔª ......

[¶­î£]javascriptÖеÄÊý¾ÝÀàÐÍ¡¢ObjectÓëFunction

1. Êý¾ÝÀàÐÍ
javascriptÖаüº¬6ÖÖÊý¾ÝÀàÐÍ£ºundefined¡¢null¡¢string¡¢number¡¢booleanºÍobject¡£ÆäÖУ¬Ç°5
ÖÖÊÇԭʼÊý¾ÝÀàÐÍ£¬objectÊǶÔÏóÀàÐÍ¡£
objectÀàÐÍÖаüÀ¨Object¡¢Function¡¢String¡¢Number¡¢Boolean¡¢Array¡¢Regexp¡¢Date¡¢
Globel¡¢Math¡¢Error£¬ÒÔ¼°ËÞÖ÷»·¾³ÌṩµÄobjectÀàÐÍ¡£
2. ÀàÐÍÅжÏ
ͨ³£ÔÚjav ......

±ßѧ±ß̸ javascriptµÄðºÅ

×òÌì¿´µ½Ò»¸öjs  ·¢ÏÖ obj=£ûa£º"123",b:"abc",objfunction:function(){...}£ý ÕâÑùµÄÓï¾ä£¬Óеã·Ñ½â
ÏÖÔÚ°Ñ´ÓÊéÉϺÍÍøÉÏÕÒµ½µÄÒ»µã¶«Î÷Ìù³öÀ´  ×ÔÓÃ&¹²Ïí
javascriptµÄðºÅ  ÓÃ;£º
1¡¢switchÓï¾ä·ÖÖ§
 
     switch (s) { 
     &nbs ......

javascriptÈÕÆÚÅжÏ

function checkserch()
{
    var stratTime =document.all("startdate").value;
    var endTime = document.all("enddate").value;
    var arr1=stratTime.split("-");
    var arr2=endTime.split("-");
    if((stratTime == '' &a ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ