Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript custom table

function tableCreate() {
  var body = document.getElementsByTagName('body')[0];
  var tbl = document.createElement('table');
  tbl.style.width = '100%';
  tbl.setAttribute('border', '1');
  var tbdy = document.createElement('tbody');
  for (var i = 0; i < 3; i++) {
    var tr = document.createElement('tr');
    for (var j = 0; j < 2; j++) {
      if (i == 2 && j == 1) {
        break
      } else {
        var td = document.createElement('td');
        td.appendChild(document.createTextNode('u0020'))
        i == 1 && j == 1 ? td.setAttribute('rowSpan', '2') : null;
        tr.appendChild(td)
      }
    }
    tbdy.appendChild(tr);
  }
  tbl.appendChild(tbdy);
  body.appendChild(tbl)
}
tableCreate();
Comment

PREVIOUS NEXT
Code Example
Javascript :: aysnc and await response data usage 
Javascript :: node package manager 
Javascript :: javascript class is not defined 
Javascript :: normalisation in js 
Javascript :: prisma.db yaml 
Javascript :: for loop increment by more than one 
Javascript :: jquery find include self 
Javascript :: repeater javascript 
Javascript :: how to add header to axios request 
Javascript :: add image to center in canvas 
Javascript :: Fetch data from multiple pages of an API in react native 
Javascript :: pymxs naming nodes 
Javascript :: pageSize useEffect 
Javascript :: should i have a webpack.config.js with yarn 
Javascript :: using Canvas with tkinger draw arc 
Javascript :: strapi-isnt-showing-both-content-types-on-graphql 
Javascript :: get time in between two dates javascript dayjs 
Javascript :: adonis model inheritance 
Javascript :: dynamic call function 
Javascript :: vite build output destination change 
Javascript :: Javascript - Dependency between arguments of partial applications 
Javascript :: How do i filter name in ng-repeat angularjs 
Javascript :: how to replace img url using jquery on mobile screen 
Javascript :: Chrome DevTools - why does variable display in Watch but not under Scope 
Javascript :: Using animateCamera in functional components in react native 
Javascript :: javascript is nodelist 
Javascript :: How do I group values to an array for the same field value in jq 
Javascript :: javascript check if key is keydown is charcter 
Javascript :: assign single value to multiple variables in React js Or javacript 
Javascript :: JSON Using Its Own Property To Get Promise Value 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =