首页 > CMS > 动易CMS > 正文

怎样修改资金余额小数位数

2024-09-10 21:55:37
字体:
来源:转载
供稿:网友

问题:怎样修改资金余额小数位数
解决:后台管理 >> 系统设置 >> 模板标签管理 >> 标签管理,找到并修改标签“Ajax用户登录”,找到下面段代码:

function GetUserInfo(xml)
{
var userInfo="<div class=/"u_login/">" xml.getElementsByTagName("username")[0].firstChild.data ",您好!您有:<br/>";
userInfo =userInfo "资金余额:" xml.getElementsByTagName("balance")[0].firstChild.data " 元<br/>";
userInfo =userInfo "经验积分:" xml.getElementsByTagName("exp")[0].firstChild.data " 分<br/>";
userInfo =userInfo "待阅短信:" xml.getElementsByTagName("msg")[0].firstChild.data " 条<br/>";
userInfo =userInfo "登录次数:" xml.getElementsByTagName("logintimes")[0].firstChild.data " 次<br/>";
userInfo =userInfo "可用点券:" xml.getElementsByTagName("point")[0].firstChild.data " " xml.getElementsByTagName("pointunit")[0].firstChild.data "<br/>";
userInfo =userInfo "待签文章:" xml.getElementsByTagName("signincontent")[0].firstChild.data " 篇<br/>";
userInfo =userInfo "<div style=/"text-align: center/"><a href=/"{PE.SiteConfig.ApplicationPath /}User/Default.aspx/" target=/"_top/">会员中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
userInfo =userInfo "<a href=/"{PE.SiteConfig.ApplicationPath /}User/Logout.aspx/" target=/"_top/">退出登录</a></div>";
userInfo=userInfo "</div>";
return userInfo;
}


改为:

function GetUserInfo(xml)
{
var userInfo="<div class=/"u_login/">" xml.getElementsByTagName("username")[0].firstChild.data ",您好!您有:<br/>";
userInfo =userInfo "资金余额:" xml.getElementsByTagName("balance")[0].firstChild.data " 元<br/>";
userInfo =userInfo "资金余额:" round(xml.getElementsByTagName("balance")[0].firstChild.data,2) " 元<br/>";
userInfo =userInfo "经验积分:" xml.getElementsByTagName("exp")[0].firstChild.data " 分<br/>";
userInfo =userInfo "待阅短信:" xml.getElementsByTagName("msg")[0].firstChild.data " 条<br/>";
userInfo =userInfo "登录次数:" xml.getElementsByTagName("logintimes")[0].firstChild.data " 次<br/>";
userInfo =userInfo "可用点券:" xml.getElementsByTagName("point")[0].firstChild.data " " xml.getElementsByTagName("pointunit")[0].firstChild.data "<br/>";
userInfo =userInfo "待签文章:" xml.getElementsByTagName("signincontent")[0].firstChild.data " 篇<br/>";
userInfo =userInfo "<div style=/"text-align: center/"><a href=/"{PE.SiteConfig.ApplicationPath /}User/Default.aspx/" target=/"_top/">会员中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;";
userInfo =userInfo "<a href=/"{PE.SiteConfig.ApplicationPath /}User/Logout.aspx/" target=/"_top/">退出登录</a></div>";
userInfo=userInfo "</div>";
return userInfo;
}
function round(v,e)
{
var t=1;
for(;e>0;t*=10,e--);
for(;e<0;t/=10,e );
return Math.round(v*t)/t;
}

修改下面的“2”,可以实现位数控制,0为无小数位,1为一位小数,2为二位小数,3为三位小数。

userInfo =userInfo "资金余额:" round(xml.getElementsByTagName("balance")[0].firstChild.data,2) " 元<br/>";

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选