<meta>
<title>去掉字符串开头的0</title>
</meta>
<body>
<input type="text" id="num">
<input type="button" value="去掉开头的0" id="btn" onClick="aaa()">
<script LANGUAGE="JScript">
function aaa(){
var num = document.getElementById('num').value
alert(~~num)
}
</script>
</body>
</html>
var a=11.00console.log(a)数字类型用的时候直接就去掉了无用的0var a='11.00'console.log(Number(a)) 字符串类型转成数字类型也就直接去掉了后面没用的0