Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var table = document.createElement('table');
table.id = 'field';
    
for (var i = 0; i < 14; i++) {
    var newRow = table.insertRow(i);
    for (var n = 0; n < 14; n++) {
        var newCell = newRow.insertCell(n);
        newCell.width = '28px';
        newCell.height = '28px';
        newCell.style.borderWidth = '1px';
        newCell.style.borderStyle = 'solid';
    }
}
    
document.body.appendChild(table);
document.getElementById('field').onclick =  function(e) {
        
    var target = e && e.target || event.srcElement;
    
    if (target.tagName == 'td') {
        target.style.backgroundColor = 'black';
    }
    return false;
};
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
fxslokerpro
0viewers