摘要:
<script> var i="123abc"; i=parseInt(i);//字符串转整形 alert(i+","+typeof(i));//输出:123,number i="12.3abc"; i=parseFloat(i);//字符串转浮点型 alert(i+","+typeof(i));//输出:12.3,number(可见不管是int还是float都是number类型) i="a123abc"; i=parseInt(i);//字符串转整形 alert(i+", 阅读全文