function FormatFloat(value,mask)
{
return BasicFormat(value,mask,'FormatNumber')
}
function FormatDate(varDate, bstrFormat, varDestLocale)
{
return BasicFormat(varDate,bstrFormat,'FormatDate',varDestLocale);
}
function FormatTime(varTime, bstrFormat, varDestLocale)
{
return BasicFormat(varTime,bstrFormat,'FormatTime',varDestLocale);
}
function BasicFormat(value,mask,action,param)
{
var xmlDoc;
var xslDoc;
var v=''+value+''+mask+'';
xmlDoc=parseXML(v);
var x;
if(isIE)
x=''
else
x='';
x+='';
if(isIE) {
x+=''+action+'('+value+',"'+mask+'"';
if(param)x+=','+param;
x+=')';
}
else
x+='';
x+='';
xslDoc=parseXML(x);
var s;
if(isIE)
s= xmlDoc.transformNode(xslDoc)
else{
//for mozilla/netscape
var processor = new XSLTProcessor();
processor.importStylesheet(xslDoc);
var result = processor.transformToFragment(xmlDoc, xmlDoc);
var xmls = new XMLSerializer();
s = xmls.serializeToString(result);
}
return s;
}
|