All pastes #161073 Raw Edit

icio

public html v1 · immutable
·published 2006-09-05 00:09 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />	<title>&lt;3 from i&copy;io</title></head><body>	<table id="t">		<tr><td>.</td><td><a onclick="doColumn(this);" href="#">1</a></td><td><a onclick="doColumn(this);" href="#">2</a></td><td><a onclick="doColumn(this);" href="#">3</a></td><td><a onclick="doColumn(this);" href="#">4</a></td><td><a onclick="doColumn(this);" href="#">5</a></td></tr>		<tr><td><a onclick="doRow(this)" href="#">1</a></td><td><input type="checkbox" id="0-0" /></td><td><input type="checkbox" id="0-1" /></td><td><input type="checkbox" id="0-2" /></td><td><input type="checkbox" id="0-3" /></td><td><input type="checkbox" id="0-4" /></td></tr>		<tr><td><a onclick="doRow(this)" href="#">2</a></td><td><input type="checkbox" id="1-0" /></td><td><input type="checkbox" id="1-1" /></td><td><input type="checkbox" id="1-2" /></td><td><input type="checkbox" id="1-3" /></td><td><input type="checkbox" id="1-4" /></td></tr>		<tr><td><a onclick="doRow(this)" href="#">3</a></td><td><input type="checkbox" id="2-0" /></td><td><input type="checkbox" id="2-1" /></td><td><input type="checkbox" id="2-2" /></td><td><input type="checkbox" id="2-3" /></td><td><input type="checkbox" id="2-4" /></td></tr>		<tr><td><a onclick="doRow(this)" href="#">4</a></td><td><input type="checkbox" id="3-0" /></td><td><input type="checkbox" id="3-1" /></td><td><input type="checkbox" id="3-2" /></td><td><input type="checkbox" id="3-3" /></td><td><input type="checkbox" id="3-4" /></td></tr>		<tr><td><a onclick="doRow(this)" href="#">5</a></td><td><input type="checkbox" id="4-0" /></td><td><input type="checkbox" id="4-1" /></td><td><input type="checkbox" id="4-2" /></td><td><input type="checkbox" id="4-3" /></td><td><input type="checkbox" id="4-4" /></td></tr>	</table>	<script type="text/javascript">	function getCheckboxes(t, rMin, rMax, cMin, cMax) {		var checks = [];		var r, c, i;		for (i=0; i<t.childNodes.length; i++) {			if (t.childNodes[i].nodeName.toLowerCase()=="tbody") {				t = t.childNodes[i];				break;			}		}		for (r=(rMin==-1?0:rMin); r<=(rMax==-1?t.childNodes.length-1:rMax); r++) {			if (t.childNodes[r].nodeName.toLowerCase() == "#text") {				if (rMax != -1) rMax++;				continue;			}			for (c=(cMin==-1?0:cMin); c<=(cMax==-1?t.childNodes[r].childNodes.length-1:cMax); c++) {							if (t.childNodes[r].childNodes[c].nodeName.toLowerCase() == "#text") {					if (cMax != -1) cMax++;					continue;				}				var inputs = t.childNodes[r].childNodes[c].getElementsByTagName("input");				for (i=0; i<inputs.length; i++) {					if (inputs[i].getAttribute("type").toLowerCase()=="checkbox") {						checks.push(inputs[i]);					}				}			}		}		return checks;	}	function doColumn(cell) {		cell = cell.parentNode;		var c;		for (c=0; c<cell.parentNode.childNodes.length; c++) {			if (cell.parentNode.childNodes[c] == cell) break;		}		invertChecks(getCheckboxes(document.getElementById("t"), 1, -1, c, c));		return false;	}	function doRow(cell) {		cell = cell.parentNode.parentNode;		var r;		for (r=0; r<cell.parentNode.childNodes.length; r++) {			if (cell.parentNode.childNodes[r] == cell) break;		}		invertChecks(getCheckboxes(document.getElementById("t"), r, r, 1, -1));		return false;	}	function invertChecks(checks) {		for (var i=0; i<checks.length; i++) {			checks[i].checked = !checks[i].checked;		}	}	</script></body></html>