W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>单击按钮可解析不同的字符串。</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var a = parseInt("10") + "<br>"; var b = parseInt("10.00") + "<br>"; var c = parseInt("10.33") + "<br>"; var d = parseInt("34 45 66") + "<br>"; var e = parseInt(" 60 ") + "<br>"; var f = parseInt("40 years") + "<br>"; var g = parseInt("He was 40") + "<br>"; var h = parseInt("10", 10)+ "<br>"; var i = parseInt("010")+ "<br>"; var j = parseInt("10", 8)+ "<br>"; var k = parseInt("0x10")+ "<br>"; var l = parseInt("10", 16)+ "<br>"; var n = a + b + c + d + e + f + g + "<br>" + h + i + j + k +l; document.getElementById("demo").innerHTML = n; } </script> </body> </html>