tablecell.setAttribute("rowspan",<value> ) not working

Discussion in 'JavaScript' started by VONRAT, Sep 17, 2006.

  1. #1
    Hello i've been trying to set the rowspan w/ the code below but it doesnt work.

    When i try to retrieve the value, it has the value and yet it doesnt display the Table cell according to the way i want it, could anybody please help, thanks :)

    
    <script language="javascript">
    function loadForm() {
    	var ot  = document.getElementById("listtble");
    	
    	var tr = ot.insertRow(ot.rows.length);
    	var td = tr.insertCell(0);
    	td.innerHTML = "content";
    	var td = tr.insertCell(1);
    	td.innerHTML = "content";
    	
    	tr = ot.insertRow(ot.rows.length);
    	var td = tr.insertCell(0);
    
    	td.setAttribute("colspan",2);  // something is wrong with this line
    
    	td.innerHTML = "content";
    	
    }
    </script>
    
    HTML:
     
    VONRAT, Sep 17, 2006 IP
  2. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    just a WILD guess, but try putting the 2 in quotes. Shot in the dark.

    Otherwise, if you've already got it to work, could you let me know how?
     
    geniosity, Sep 20, 2006 IP
  3. VONRAT

    VONRAT Banned

    Messages:
    181
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    whew ... i thought this one is a lost case .. haha finally worked

    btw .. the code above works fine in firefox but not in IE ...

    the only solution was case sensitivity

    i used ... colSpan instead of colspan :D

    mannnnn why cant these browser just follow one standard format
     
    VONRAT, Sep 21, 2006 IP
  4. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Because IE grew up at a time when there was no standard format for these things, and it's rested on its "laurels" ever since.

    Attribute values are always strings, that's why quotes are required.

    - P
     
    penagate, Sep 27, 2006 IP