You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.0 KiB
Plaintext

11 months ago
function Rmb2DaXie(val) {
//<2F>˴<EFBFBD><CBB4><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ʱ<EFBFBD><CAB1>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵķ<D6B5><C4B7><EFBFBD><EFBFBD>Զ<EFBFBD>ȥ<EFBFBD><C8A5>
var rmb = clearNoNum(val);
var dx = AmountLtoU(rmb);
if (dx == '<27><>Ч') {
alert('<27><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ʽ<EFBFBD><CABD>');
return false;
}
return dx;
}
function AmountLtoU(num) {
///<summery>Сд<D0A1><D0B4><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD></summery>
///<param name=num type=number><3E><><EFBFBD><EFBFBD></param>
if (isNaN(num)) return "<22><>Ч";
var strPrefix = "";
if (num < 0) strPrefix = "(<28><>)";
num = Math.abs(num);
if (num > 999000000000000) return "<22><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>999<39><39><EFBFBD><EFBFBD>)"; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>999<39><39><EFBFBD><EFBFBD>
var strOutput = "";
var strUnit = '<27><>ʰ<EFBFBD><CAB0>Ǫ<EFBFBD><C7AA>ʰ<EFBFBD><CAB0>Ǫ<EFBFBD><C7AA>ʰ<EFBFBD><CAB0>Ǫ<EFBFBD><C7AA>ʰԲ<CAB0>Ƿ<EFBFBD>';
var strCapDgt = '<27><>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>ƾ<EFBFBD>';
num += "00";
var intPos = num.indexOf('.');
if (intPos >= 0) {
num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
}
strUnit = strUnit.substr(strUnit.length - num.length);
for (var i = 0; i < num.length; i++) {
strOutput += strCapDgt.substr(num.substr(i, 1), 1) + strUnit.substr(i, 1);
}
return strPrefix + strOutput.replace(/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>$/, '<27><>').replace(/<2F><><><C7AA>ʰ]/g, '<27><>').replace(/<2F><>{2,}/g, '<27><>').replace(/<2F><>([<5B><>|<7C><>])/g, '$1').replace(/<2F><>+Բ/, 'Բ').replace(/<2F><><EFBFBD><EFBFBD>{0,3}<7D><>/, '<27><>').replace(/^Բ/, "<22><>Բ");
};
function getArgsFromHref(sArgName) {
var sHref = window.location.href;
var args = sHref.split("?");
var retval = "";
if (args[0] == sHref) /*<2A><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>*/
{
return retval; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κδ<CEBA><CEB4><EFBFBD>*/
}
var str = args[1];
args = str.split("&");
for (var i = 0; i < args.length; i++) {
str = args[i];
var arg = str.split("=");
if (arg.length <= 1) continue;
if (arg[0] == sArgName) retval = arg[1];
}
return retval;
}
function clearNoNum(val) {
val = val.replace(/[^\d.]/g, ""); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>͡<EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
val = val.replace(/^\./g, ""); //<2F><>֤<EFBFBD><D6A4>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>.
val = val.replace(/\.{2,}/g, "."); //ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
val = val.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
return val;
}