<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>显示类型转换</title>
</head>
<body>
<h1>obvious converting</h1>
<hr>
<script language="javascript">
<!--var myString = "ABCdeFg";
var lowercased = myString.toLowerCase();
document.write(myString+"转换为小写后为:"+lowercased);
document.write("<br><br></br>");var a=typeof(toString(NaN));
var b=typeof(toString(true));
var c=parseInt("");
var d=parseInt("5");
var e=parseInt("this");
var f=parseInt(true);
var g=typeof(d);
var h=typeof(parseFloat("5"));document.write("the type of toString(NaN) is:"+a+"<br>");
document.write("the type of toString(true) is:"+b+"<br>");
document.write("the type of parseInt("") is:"+c+"<br>");
document.write("the type of parseInt("5") is:"+d+"<br>");
document.write("the type of parseInt("this") is:"+e+"<br>");
document.write("the type of parseInt("true") is:"+f+"<br>");
document.write("the type of parseInt("5") is:"+g+"<br>");
document.write("the type of parseFloat("5") is:"+h+"<br>");
-->
</script>
</body>
</html>
刚学JS没几天,按照书上敲了几个例子,这个确显示不出来

解决方案 »

  1.   


    document.write("the type of parseInt("") is:"+c+"<br>");
    document.write("the type of parseInt("5") is:"+d+"<br>");
    document.write("the type of parseInt("this") is:"+e+"<br>");
    document.write("the type of parseInt("true") is:"+f+"<br>");
    document.write("the type of parseInt("5") is:"+g+"<br>");
    document.write("the type of parseFloat("5") is:"+h+"<br>");把parseInt("")括号中的""改成''即可。
      

  2.   

    document.write("the type of toString(NaN) is:"+a+"<br>");
    document.write("the type of toString(true) is:"+b+"<br>");
    document.write("the type of parseInt('') is:"+c+"<br>");
    document.write("the type of parseInt('5') is:"+d+"<br>");
    document.write("the type of parseInt('this') is:"+e+"<br>");
    document.write("the type of parseInt('true') is:"+f+"<br>");
    document.write("the type of parseInt('5') is:"+g+"<br>");
    document.write("the type of parseFloat('5') is:"+h+"<br>");