fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <p id="demo">单击按钮将不同的对象值转换为数字。</p> <button onclick="myFunction()">点我</button> <script> function myFunction(){ var test1 = new Boolean(true); var test2 = new Boolean(false); var test3 = new Date(); var test4 = new String("999"); var test5 = new String("999 888"); var n = Number(test1) + "<br>" + Number(test2) + "<br>" + Number(test3) + "<br>" + Number(test4) + "<br>" + Number(test5); document.getElementById("demo").innerHTML=n; } </script> </body> </html>
运行结果