NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
![](https://box.kancloud.cn/463aa3a918ff1d414fdc23bb85e5df62_363x304.gif) ~~~ <div id="test" style="height: 100px;"></div> <script> // string-->number /* parseInt(); parseFloat(); Tip;第一为必需位数字 */ var test = document.getElementById("test"); var height = test.style.height; console.log(parseInt(height)); test.onclick = function(){ this.style.height = parseInt(this.style.height)+1+"px"; } var a ="12px"; var b = "a1"; var c ="13.25px" console.log(parseInt(a)); console.log(parseInt(b)); console.log(parseInt(c)); console.log(parseFloat(c)); </script> ~~~