把0去掉
 var strStaffCd =String(json.root[i].StaffCd).replace(/^0*/,'')

解决方案 »

  1.   

    var strStaffCd =Number(String(json.root[i].StaffCd),10)
      

  2.   

    .strStaffCd  = "00010";00010是字符串要加引号,不加引号就是数值数据,而且,以0开头并且只有0-7的数值数据会被认作为八进制。 
      

  3.   


    我要带0 的数据, 而不是去掉0后的数据 也就是说我要String类型的数据aaa(strStaffCd );   00010function aaa(staffCd) {
     var a = staffCd;  // 我要这结果里要00010 的数据
     } 
      

  4.   


    现在主要是 不太好加 字符窜
    代码如下var strStaffCd = json.root[i].StaffCd;
    table += '<tr' + ((i % 2 == 0) ? ' style="background-color:#eff3fb;"' : '') + '>';
    table += '<td class="grid-item-style-center" style="width:30px;"><input type="checkbox" name="chkSelect" value="' + ((CurrentPage - 1) * PageUnitNumber + i) + '" ' + ((json.root[i].Selected == 'True')?'checked="checked"':'') + ' onclick="this.blur();this.focus();" onchange="aaa(this.checked,' +i+','+strStaffCd + ');"' + ((json.root[i].GroupLimit == '0')?'disabled="disabled"':'') + ' /></td>';
      

  5.   

    原来代码是 用代码生成的  检索一览项  我要改的地方是 单选项 onchange 事件的时候 我要取得 用户名  用户名 有可能是00010 这样的数据
      

  6.   

     table += '<td class="grid-item-style-center" style="width:30px;"><input type="checkbox" name="chkSelect" value="' + ((CurrentPage - 1) * PageUnitNumber + i) + '" ' + ((json.root[i].Selected == 'True')?'checked="checked"':'') + ' onclick="this.blur();this.focus();" onchange="aaa(this.checked,' +i+',\''+strStaffCd + '\');"' + ((json.root[i].GroupLimit == '0')?'disabled="disabled"':'') + ' /></td>';