問題:如何修改資金余額小數(shù)位數(shù)
解決:后臺管理 >> 系統(tǒng)設(shè)置 >> 模板標(biāo)簽管理 >> 標(biāo)簽管理,找到并修改標(biāo)簽“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 +"經(jīng)驗積分:"+xml.getElementsByTagName("exp")[0].firstChild.data+" 分<br/>"; userInfo =userInfo +"待閱短信:"+xml.getElementsByTagName("msg")[0].firstChild.data+" 條<br/>"; userInfo =userInfo +"登錄次數(shù):"+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> | "; 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 +"經(jīng)驗積分:"+xml.getElementsByTagName("exp")[0].firstChild.data+" 分<br/>"; userInfo =userInfo +"待閱短信:"+xml.getElementsByTagName("msg")[0].firstChild.data+" 條<br/>"; userInfo =userInfo +"登錄次數(shù):"+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> | "; 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”,可以實現(xiàn)位數(shù)控制,0為無小數(shù)位,1為一位小數(shù),2為二位小數(shù),3為三位小數(shù)。
|
userInfo =userInfo +"資金余額:"+round(xml.getElementsByTagName("balance")[0].firstChild.data,2)+" 元<br/>";
|
查看更多 動易Cms教程 動易Cms模板