View Single Post
 
Old January 11th, 2005, 06:55 AM
vinod_yadav1919 vinod_yadav1919 is offline
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Roshu,

You can use objtd.colSpan=3 if you are using (IE/Opera)
and objtd.setAttribute('colspan', 3);

Hope below code help you
<script>
function check()
{
     mainobj=document.getElementById("divid")

        mytable = document.createElement("TABLE");
        mytable.bgColor="red"
        mytablebody = document.createElement("TBODY");

         mycurrent_row=document.createElement("TR");
         mycurrent_cell=document.createElement("TD");

         filex = document.createElement('input');
      filex.setAttribute('type','file');

        mycurrent_cell.appendChild(filex)
        mycurrent_row.appendChild(mycurrent_cell)
        mycurrent_cell.colSpan="3"

       mytablebody.appendChild(mycurrent_row)
       mytable.appendChild(mytablebody)

      mytablebody = document.createElement("TBODY");
      mycurrent_row=document.createElement("TR");
      for(j=0;j<3;j++) {
                  mycurrent_cell=document.createElement("TD");
                 if(j==0)
                  inputtype="radio"
                 else
                  inputtype="text"

             objcell=document.createElement("input")
             objcell.type=inputtype
        mycurrent_cell.appendChild(objcell)
              mycurrent_row.appendChild(mycurrent_cell)
                     }
       mytablebody.appendChild(mycurrent_row)
         mytable.appendChild(mytablebody)
  mainobj.appendChild(mytable)
}
</script>
<div id="divid">
</div>

<input type=button value="CreateTable" onclick="check()">

Cheers :)

vinod