How to set width of a div in percent in JavaScript?

后端 未结 7 964
我寻月下人不归
我寻月下人不归 2020-12-09 08:09

Is it possible to set the height/width of an element in percent using JavaScript or jQuery?

7条回答
  •  忘掉有多难
    2020-12-09 08:49

    testjs2

        $(document).ready(function() { 
          $("#form1").validate({ 
            rules: { 
              name: "required", //simple rule, converted to {required:true} 
              email: { //compound rule 
              required: true, 
              email: true 
            }, 
            url: { 
              url: true 
            }, 
            comment: { 
              required: true 
            } 
            }, 
            messages: { 
              comment: "Please enter a comment." 
            } 
          }); 
        }); 
    
        function()
        {
        var ok=confirm('Click "OK" to go to yahoo, "CANCEL" to go to hotmail')
        if (ok)
        location="http://www.yahoo.com"
        else
        location="http://www.hotmail.com"
        }
    
        function changeWidth(){
        var e1 = document.getElementById("e1");
        e1.style.width = 400;
    } 
    
       
    
       
    
       
       
    
        
    Name *
    E-Mail *
    URL
    Your comment *

提交回复
热议问题