js技巧收集(200多个)
integral = parts[0];
decimal = parts[1];
// Cut down redundant decimal digits that are after the second.
decimal = decimal.substr(0, 2);
}
else {
integral = parts[0];
decimal = "";
}
// Prepare the characters corresponding to the digits:
digits = new Array(CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, 本文来自织梦
CN_NINE);
radices = new Array("", CN_TEN, CN_HUNDRED, CN_THOUSAND);
bigRadices = new Array("", CN_TEN_THOUSAND, CN_HUNDRED_MILLION);
decimals = new Array(CN_TEN_CENT, CN_CENT);
// Start processing:
outputCharacters = "";
// Process integral part if it is larger than 0:
if (Number(integral) > 0) {
zeroCount = 0;
for (i = 0; i < integral.length; i ) {
p = integral.length - i - 1;
d = integral.substr(i, 1);
quotient = p / 4;
modulus = p % 4;
if (d == "0") {
zeroCount ;
}
else {
if (zeroCount > 0)
{
outputCharacters = digits[0];
}
zeroCount = 0;
outputCharacters = digits[Number(d)] radices[modulus];
}
if (modulus == 0 && zeroCount < 4) {
outputCharacters = bigRadices[quotient];
}
}
outputCharacters = CN_DOLLAR;
}
// Process decimal part if there is:
if (decimal != "") {
for (i = 0; i < decimal.length; i ) {
d = decimal.substr(i, 1);
if (d != "0") {
copyright dedecms
outputCharacters = digits[Number(d)] decimals[i];
}
}
}
// Confirm and return the final output string:
if (outputCharacters == "") {
outputCharacters = CN_ZERO CN_DOLLAR;
}
if (decimal == "") {
outputCharacters = CN_INTEGER;
}
outputCharacters = CN_SYMBOL outputCharacters;
return outputCharacters;
}// copyright dedecms
166.xml数据岛绑定表格
<html>
<body>
<xml id="abc" src="test.xml"></xml>
<table border='1' datasrc='#abc'>
<thead>
<td>接收人</td>
<td>发送人</td>
<td>主题</td>
<td>内容</td>
</thead>
<tfoot>
<tr><th>表格的结束</th></tr>
</tfoot>
<tr>
<td><div datafld="to"></div></td>
<td><div datafld="from"></div></td>
<td><div datafld="subject"></div></td>
<td><div datafld="content"></div></td>
</tr>
</table>
</body>
</html>
dedecms.com
//cd_catalog.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Edited with XML Spy v4.2
-->
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
文章评论
共有位Admini5网友发表了评论 查看完整内容