js实现一个人民币小写金额转成大写金额的代码

代码语言:html

所属分类:其他

代码描述:js实现一个人民币小写金额转成大写金额的代码

代码标签: 人民币 小写 金额 转成 大写 金额

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
   
<meta charset="UTF-8">

   
<style>

        body
{
           
background: white;
       
}
        h1
{

           
font: 32px "微软雅黑","Microsoft YaHei";
           
color: #333;
           
margin-bottom: 6px;
           
text-align: center;
       
}
       
.title {
           
width: 100%;
           
border: 0;
           
padding: 4px 0;
       
}
       
.title .zuozhe {
           
color: #AAA
       
}
       
.title span {
           
float: right;
           
margin-top: -40px
       
}
       
.title a {
           
color: #390;
           
padding: 4px
       
}

       
/* 文本域 */
       
.tooltext {
           
padding: 4px;
           
margin: 10px 0;
           
font-size: 16px;

           
color: #333
       
}
       
.toolarea {
           
padding: 4px;
           
margin: 8px 0;
           
width: 100%;
           
height: 250px;
           
color: #333;
           
display: block
       
}

       
/* 按钮 */
       
.bt-green {
           
font-size: 14px;
           
border: none;
           
line-height: 33px;
           
background: #6FB934;
           
font-weight: bold;
           
color: #FFF;
           
cursor: pointer;
           
padding: 0 18px;
           
margin-right: 12px
       
}
       
.bt-green:hover {
           
background: #5FA924;
           
text-decoration: none
       
}

       
.toolcode {
           
margin: 0 8px 26px
       
}

        hr
{
           
border: 0;
       
}
   
</style>
</head>
<body>

   
<div class="toolcode">

       
<p class="alert alert-info">
            转换方法:输入人民币金额的小写阿拉伯数字,例如1688.99,然后点击“转换为大写金额”按钮即可得转换成汉字。在输入数字的时候,可以包含小数点,也可以写成千进制,例如1,688.99(注意是英文逗号,而不是中文逗号)。
       
</p>
       
<p>
            小写金额(¥):
<br>
           
<input name="Digits" class="tooltext" id="Digits" value="1,688.99" size="40" type="text">
           
<input id="Convert" class="bt-green" value="转换为大写金额" name="Convert" onclick="Result.value = convertCurrency(Digits.value);" type="button">
       
</p>
       
<div style="clear:both"></div>
       
<p>
            大写金额:
           
<textarea name="Result" type="text" class="toolarea" style="color:#333;font-size:28px;height:36px" id="Result"></textarea>
       
</p>
       
<p class="alert alert-success">
            人民币金额用到的中文大写汉字如下:
<br>
           
<strong>零、壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿。 </strong>
       
</p>

   
</div>
   
<script type="text/javascript" charset="utf-8">
        function convertCurrency(currencyDigits) {
            // Cons.........完整代码请登录后点击上方下载按钮下载查看

网友评论0