All pastes #506580 Raw Edit

Anonymous

public javascript v1 · immutable
·published 2007-05-24 02:22 UTC
rendered paste body
function lights_out_init() {	// build the table	var tabl = document.createElement('table');	tabl.id = 'lights-out-grid';	for(var y = 0; y < 5; y++) {		var row = document.createElement('tr');		for(var x = 0; x < 5; x++) {			var cell = document.createElement('td');			cell.id = 'lights-out-cell-' + x + '-' + y;			YAHOO.util.Event.addListener(cell, "click", lights_out_button_click);			row.appendChild(cell);		}		tabl.appendChild(row);	}	alert(tabl.id);	var placeholder = document.getElementById('lights-out-placeholder');	placeholder.appendChild(tabl);		var button = null;	var buttons_para = document.createElement('p');	buttons_para.id = 'lights-out-game-buttons';		button = document.createElement('button');	button.appendChild(document.createTextNode('New Game'));	YAHOO.util.Event.addListener(button, 'click', lights_out_reset_game);	buttons_para.appendChild(button);		buttons_para.appendChild(document.createTextNode(" "));		button = document.createElement('button');	button.appendChild(document.createTextNode('Randomise'));	YAHOO.util.Event.addListener(button, 'click', lights_out_randomise_game);	buttons_para.appendChild(button);		placeholder.appendChild(buttons_para);		lights_out_reset_game();	}