要完成此效果需要两个步骤 第一步:把如下代码加入到<head>区域中 <script> <!-- Begin function toBin(form) { base = parseInt(form.base.value); num = parseInt(form.num.value); form.amount.value = num.toString(base); } // End --> </script> 第二步:把如下代码加入到<body>区域中 <form name=numform> <center> 要转换的数 <input type=text name=num size=8> 转换的进制数 <input type=text name=base size=8 value=2 onBlur="if ((this.value<1)||(this.value>36)){alert('The base must be between 2 and 36.');this.select();this.focus();}"> <input type=button value="转换" onclick="toBin(this.form)"> <input type=text name=amount size=15> </center> </form> 载入中... 载入中...
Copyright © 2000-2006 Nkcn.Net 天津网站优化 All Rights Reserve.