Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var row;
- var col;
- var player;
- //var human = true;
- var lvl;
- var four = document.getElementById("four");
- var five = document.getElementById("five");
- var six = document.getElementById("six");
- var easy = document.getElementById("easy");
- var medium = document.getElementById("medium");
- var hard = document.getElementById("hard");
- var comp = document.getElementById("computer");
- var hum = document.getElementById("human");
- var run = document.getElementById("imgrungame");
- var dot = document.getElementById("dot");
- window.onload = function() {
- four.onclick = function() {
- var tam = four.getAttribute("value");
- row = tam;
- col = tam;
- }
- five.onclick = function() {
- var tam = five.getAttribute("value");
- row = tam;
- col = tam;
- }
- six.onclick = function() {
- var tam = six.getAttribute("value");
- row = tam;
- col = tam;
- }
- easy.onclick = function() {
- var lvl = easy.getAttribute("value");
- }
- medium.onclick = function() {
- var lvl = medium.getAttribute("value");
- }
- hard.onclick = function() {
- var lvl = hard.getAttribute("value");
- }
- human.onclick = function() {
- var player = human.getAttribute("value");
- }
- comp.onclick = function() {
- var player = comp.getAttribute("value");
- }
- run.onclick = function() {
- drawBoard(row,col);
- }
- function drawBoard(row, col) {
- var div = document.createElement('div');
- var table = document.createElement('table');
- div.className = "board";
- div.appendChild(table);
- table.className = "table";
- for(var i=0; i<row; i++) {
- var tr = document.createElement('tr');
- for(var j=0; j<col; j++) {
- var td = document.createElement('td');
- td.id = "dot"+i+j;
- tr.appendChild(td);
- td.addEventListener("click", remove(i,j,"dot"+i+j), false);
- }
- table.appendChild(tr);
- }
- document.body.appendChild(div);
- }
- }
- function remove(x,y,id) {
- this.x = x;
- this.y = y;
- this.id = id;
- var removed = document.getElementById("id");
- removed.style.display = "none";
- console.log(removed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement