调试运行
<html> <head> <title>将字符串转换成数字</title> </head> <body> <script language="javascript"> <!-- str = "3.14"; num = parseFloat(str); document.write(0 + num); --> </script> </body> </html>