点击确定后修改div的style 

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script type="text/javascript">
      <!--
    function chgbig(){
    var divobj = document.getElementById("div1");
    divobj.style.width = parseInt(divobj.style.width)+10;
    divobj.style.height = parseInt(divobj.style.height)+10;
    }
      //-->
      </script>
     </head> <body>
      <button onclick="chgbig()">变大</button>
      <div id="div1" style="border:1px black solid;background-color:#cfcfcf;width:300px;height:300px">
      </div>
     </body>
    </html>
      

  2.   


    <style>
    #div1{height:100px;width:100px;background-color:yellow}
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $("#abv").click(function(){
    $("#div1").height($("#hei").val()).width($("#wid").val());
    });
    })
    </script>
    <div id="div1"></div>
    宽<input type="text" id="wid"/>
    高<input type="text" id="hei"/>
    <input type="button" id="abv" value="确定"/>
      

  3.   


    多谢.已经成功做出来更改.还有些原理性的东西请教.
    现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢.
      

  4.   

    刷新必然样式重置,想要保存样式不一定非得借助后端语言,可以把状态存入cookie中(jquery提供该插件)或者localstorage中,方法自己百度一下,满意的话请结贴吧。
    多谢.已经成功做出来更改.还有些原理性的东西请教.
    现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢.