this is some testing i did there might be some bugs not sure :)

DynTable=function(x,y,w,h,col,border,pad,space){
        var table = document.createElement('TABLE');
        table.tr=[] 
        table.setAttribute('border',border||0);
        table.setAttribute('cellPadding',pad||0);
        table.setAttribute('cellSpacing',space||0);
        table.style.position = "relative"
        table.style.left =x+"px"
        table.style.top =y+"px"
        table.setAttribute('height',h)
        table.setAttribute('width',w)
        var tbody = document.createElement('TBODY')
        table.addTR=function(n){
                for (i=0;i<n;i++){
                        table.tr[i]=document.createElement('TR');
                        tbody.appendChild(table.tr[i]); 
                }
        }
        table.addTD=function(tr,td,colspan,rowspan,text){
                var TD = document.createElement('TD')
                tr.appendChild(TD)
                TD.id=td
                if(colspan)TD.setAttribute('colSpan',colspan)
                if(rowspan)TD.setAttribute('rowSpan',rowspan)
                TD.innerHTML=text
        }
        table.setFontColor=function(c){
                var td=table.getElementsByTagName('td')
                for(i=0;i<td.length;i++){td[i].style.color=c}
        }
        table.setFontFamily=function(ff){
                table.style.fontFamily=ff
        }
        table.appendChild(tbody)
        table.style.backgroundColor=col
        table.style.visibility = "visible"
        table.style.padding= "0px 0px 0px 0px"
        return table
}

function init(){
        table1 = new DynTable(100,100,400,300,'#ffffff',1,10,0)
        table1.addTR(3)
        table1.addTD(table1.tr[0],'td1',2,null,'test!')
        table1.addTD(table1.tr[0],'td2',null,null,'test!')
        table1.addTD(table1.tr[1],'td1',null,null,'test!')
        table1.addTD(table1.tr[1],'td2',null,null,'test!')
        table1.addTD(table1.tr[1],'td3',null,null,'test!')
        table1.addTD(table1.tr[2],'td1',3,null,'test')
        table1.setFontColor('#ff0000')
        table1.setFontFamily('sans serif')
        document.body.appendChild(table1);
}

ciao
Y



_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to