<!DOCTYPE html> <html> <head> <script type="text/javascript"> function boom() { var table = document.createElement('table'); document.body.appendChild(table); var colgroup = document.createElement('colgroup'); table.appendChild(colgroup); var col = document.createElement('col'); colgroup.appendChild(col); } </script> </head> <body onload="boom();"></body> </html>