js元素

1.document.createElement
动态创建HTML对象

<script language="javascript">
var o = document.body;
//创建链接
function createA(url,text)
{
    var a = document.createElement("a");
    a.href = url;
    a.innerHTML = text;
    a.style.color = "red";
    o.appendChild(a);
}
createA("http://www.jz123.cn/","中国建站之家");
</script>


2.With
为一个或一组语句指定默认对象。

with(dv.style){
        position = "absolute";
        left = "0px";
        top = "0px";
        width ="100%";
        height ="100%";
    }



posted @ 2008-07-08 10:18  杰仔  阅读(325)  评论(0编辑  收藏  举报