<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<script language="javascript">
   window.onload=function(){
       function Class1(){
     this.color="red"
 this.medth=function(){
       alert("dd")
 }
 Class1.prototype.mm="45"
 function mm(){
   alert("mm")
 }
   
   }
   
 
   

  var stylesheet={
       width:"500px",
   height:"250px",
   backgroundColor:"#ff0000",
   borderWidth:"1px"
   } 
  var odiv=document.getElementById("odiv");
    
       
     for(var sheet in odiv){
    odiv.style[sheet]=stylesheet[sheet];
 }

}

  
</script>
</head><body><div id="odiv">
</div>
</body>
</html>

解决方案 »

  1.   

    没有效果,,, 就是给ODVI 添加样式
      

  2.   

         for(var sheet in stylesheet){
                odiv.style[sheet]=stylesheet[sheet];
             }
      

  3.   

    <META NAME="Author" CONTENT="theforever(碧海情天),赵亮">
    <meta http-equiv="email" content="theforever·163。com">
    <meta http-equiv="blog" content="blog.csdn.net/theforever">
    <script language="javascript">
    window.onload = function() {
    var stylesheet = {
    width: "500px",
    height: "250px",
    backgroundColor: "#ff0000",
    borderWidth: "1px"
    };
    var odiv = document.getElementById("odiv");
    for (var s in stylesheet) {
    odiv.style[s] = stylesheet[s];
    }
    }
    </script>
    </head>
    <body>
    <div id="odiv"><font color=blue size=+7>theforever</font>
    </div>