js中循環array string windows對象等用法

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新建網頁</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="布爾教育 http://www.itbool.com" />
<script>
    var a=[1,2,3,4,5,6];
    for (var i = a.length - 1; i >= 0; i--) {
        document.write(a[i]);
    };
    var obj={name:'lisi',age:23,number:2013};
    for(var k in obj){
        document.write(k+'~'+obj[k]+"\t");
    }

    var str='helloworld';
    document.write(str.length);
    document.write(str.substr(2,3));
    var az=[1,2,3,4];
    document.write(az.join(','));
    var str='春,夏,秋,冬';
    document.write(str.split(','));
</script>

</head>
    <body>
        js的循環結構  對象打印對象和值
    </body>
</html>html

/*********************************************/windows

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>js內置對象</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="布爾教育 http://www.itbool.com" />
<script>
    var str="heloworld";
    document.write(str.indexOf("he"));
</script>
</head>
    <body>
        <!--js查找若是沒找到,返回-1
        string對象 date對象 math對象-->
    </body>
</html>瀏覽器

/*****************************************************************************/ui

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>瀏覽器windows對象</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="布爾教育 http://www.itbool.com" />
<script>
    window.confirm('gg');
</script>
</head>
    <body>
        window彈出新的窗口提示確認
    </body>
</html>xml

相關文章
相關標籤/搜索