Javascript Control Style in creating a new element

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akoymakoy
    New Member
    • Oct 2006
    • 42

    Javascript Control Style in creating a new element

    hi
    i have this function which sets the attribute of my select element:

    Code:
    var cell4 = row.insertCell(4);
    var selectCost = document.createElement("select");
    setAttributeForElementSelect(selectCost , 'COST_'+nextRow , '80' );
    
    function setAttributeForElementSelect(element,nameIDandTitle,width){
    			element.setAttribute('id',nameIDandTitle);
    			element.setAttribute('title',nameIDandTitle);			
    			element.setAttribute('name',nameIDandTitle);			
    			element.setAttribute('width',width);	
    }
    width doesn't work in adjusting the size

    how do i set the width of my select?

    Thanks in advance
    Last edited by Dormilich; Feb 11 '09, 06:30 AM. Reason: added [code] tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by akoymakoy
    width doesn't work in adjusting the size
    of course not, width is not a valid attribute for select. so is width for any inline element (same goes for height, margin & padding).

    regards

    Comment

    Working...