Created
March 29, 2011 13:06
-
-
Save nus/892316 to your computer and use it in GitHub Desktop.
Javascriptでtableを操作
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>javascript table</title> | |
<script type="text/javascript"> | |
function onload() | |
{ | |
var table = document.getElementById("t"); | |
for(var i = 0; i < 20; i++ ) { | |
var row = table.insertRow(-1); | |
var number = row.insertCell(-1); | |
var content = row.insertCell(-1); | |
number.innerHTML = i + 1; | |
content.innerHTML = "a"; | |
} | |
} | |
</script> | |
</head> | |
<body onload="onload()"> | |
<p>javascriptでtableを操作</p> | |
<table border="4" id="t"> | |
<tr> | |
<th>No.</th> | |
<th>内容</th> | |
</tr> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment