var b=document.form1.cj.value;
alert(parseInt(b, 10));  //"060"被转换后就是60

解决方案 »

  1.   

    var b=document.form1.cj.value;
    if(b.substring(0,1)=='0'){
    alert("错误");
    document.form1.cj.value=b.substring(1,b.length);
    }
      

  2.   

    <form name=form1>
    <input type=text name=cj >
    </form>
    <input type=button value='check' onclick='checka()'>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function checka(){
    var b=document.form1.cj.value;
    if(b.substring(0,1)=='0'){
    alert("错误");
    document.form1.cj.value=b.substring(1,b.length);
    }
    else{
    alert("right");
    }
    }
    //-->
    </SCRIPT>