<script><BR> ;<BR> i=parseInt(i);//字串轉整形<BR> alert(i "," typeof(i));//輸出:123,number<BR> i="12.3abc";<BR> i=parseFloat(i);//字串轉浮點型<BR> alert(i "," typeof(i));//輸出:12.3,number(可見不管是int還是float都是number型別)<BR> i="a123abc";<BR> i=parseInt(i);//字串轉整形<BR> alert(i "," typeof(i));//輸出:NaN,number(由於轉換失敗,所以提示「不是數字,Not a Number」)<BR> var num=document.getElementById("num").value;<BR> function showMsg(num i=0;i<num;i )<BR> {<BR> document.write("你好,Java ><BR><BR><BR></script>