JS的日期加减函数:
function dateAdd(date,dayNum){
var a = date.valueOf();
a = a + dayNum * 24 * 60 * 60 * 1000;
a = new Date(a);
return a;
}
JS把字符串装载到DOM对象:
var doc = new ActiveXObject("MSxml2.DOMDocument");
doc.loadXML( xmlStr);
当JS的正则表达式的pattern需要动态构造时,需要使用RegExp类:
patt=new RegExp(today.replace(/\-/g,"\\-")+"((.|\n|\r|\t)+)"+yesterday.replace(/\-/g,"\\-"),"gm");
//patt=new RegExp("2008\-5\-26((.|\n)+)2008\-5\-25","gm");
h = h.replace(patt,yesterday);
而不能使用/dd/gm之类简单的pattern