问答详情
源自:4-1 编程挑战

1.宽高带有单位,改变宽高怎么写,2.还有那个取消设置怎么写,

//定义"改变宽高"的函数
   function hewe()
   {
       var a=document.getElementById("con");
       var b=document.getElementById("txt");
       a.style.width="300";
       b.style.height="100";
   }

提问者:慕粉3761274 2016-08-24 12:04

个回答

  • 雪舞樱尘
    2016-08-24 14:27:13
    已采纳

    function hewe()
       {
           var a=document.getElementById("con");
           var b=document.getElementById("txt");
           a.style.width="300px";
           b.style.height="100px";
       }

    function changeCancelSet(){

        var mychar = confirm("是否取消设置?");

        if(mychar){

            var a= document.getElementById("con");

            var b= document.getElementById("txt");

            a.style.width="600px";

            b.style.height="400px";            

        }

    }


  • Fyang
    2016-08-25 15:48:00

    取消设置,obj.style='null'

  • HappySimon
    2016-08-24 14:40:03

    function setSize(){
           document.getElementById("con").style.width = "1000px";
            document.getElementById("con").style.height = "20px";

    function setRest(){

     var sign = confirm("确定取消设置?");
            if(sign) {
                document.getElementById("con").style.color = color;
                document.getElementById("con").style.width = width;
               document.getElementById("con").style.height = height;
               document.getElementById("txt").style.display = dis;

     }