<html>
<head>
<style type = "text/css">
#show{
width:100px;
height:100px;
background:pink;
margin:0 auto;
}
</style>
<title>进制转化</title>
<script type = "text/JavaScript">
document.write("div id = 'show'>");
var data = parseInt(prompt("请输入十进制数",0));
var base = parseInt(prompt("请输入进制基数(2,8,16)",2));
var result;
switch(base){
case 2:
case 8:
case 16: result = data.toString(base);
}
document.write("</div>");
alert(result);
</script>
</head>
</html>
JavaScript 中.toString() 大全
http://www.cnblogs.com/muguaworld/archive/2008/07/18/1246338.html