怎樣修改資金余額小數位數_動易Cms教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      問題:怎樣修改資金余額小數位數
      解決:后臺管理 >> 系統設置 >> 模板標簽管理 >> 標簽管理,找到并修改標簽“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/>";

      查看更多 動易Cms教程  動易Cms模板

      來源:模板無憂//所屬分類:動易Cms教程/更新時間:2009-04-02
      相關動易Cms教程