第一次作业

<!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=utf-8" />
<title>js</title>
</head>

<body>
<!--作业一-->
<script type="text/javascript">
    //JavaScript:写入 HTML 输出
    document.write("document.write:<em>hello world!~</em><br />");
    
    //
    prompt("are you boy?","no!~");
    
    //JavaScript:数据类型
    var i;
    var x = new Array();
    var x = [new Object(),6,6.6,"hello world!~",false,null,isNaN,undefined];
    
    //or
     /*
        x[0] = "hello world!~";    //x为字符串     string类型
        x[1] = 6;                //x为数字        int类型
        x[2] = 6.6;                //x为小数     double类型
        x[3] = isNaN;            //这是一个判断对象是否为数字的方法
        x[4] = new Object();    //x为一个新的对象
        x[5] = null;            //通过将值设为null来清除变量
        x[6] = undefined;        //x为 undefined 无返回值 未定义
        x[7] = false;            //x为真假        bool类型 true
    */
    
    for(i=0;i<x.length;i++){
            document.write(typeof x[i] + "<br />");
        }
        
    
</script>
<!--//JavaScript:对事件作出反应-->
<button type="button" onclick="alert('hello world!~')">click me!</button>
<!--作业一-->
</body>
</html>

原文地址:https://www.cnblogs.com/crafts/p/3823022.html