源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <script> var myNumber = 128; document.write(myNumber + ' 十进制<br>'); document.write(myNumber.toString(16) + ' 十六进制<br>'); document.write(myNumber.toString(8) + ' 八进制<br>'); document.write(myNumber.toString(2) + ' 二进制<br>'); </script> </body> </html>
运行结果