往表格中添加单元格示例

 <script type="text/javascript">
					var n=1;
					function writeTd(){	
						n++;
						var tr1=document.getElementById("pic").insertRow();
						var td1=tr1.insertCell();
						var td2=tr1.insertCell();
						td1.insertAdjacentText("afterBegin", "picture"+n)
						td2.insertAdjacentHTML("afterBegin","<input type=file name=pic>");
						
					}
		</script>

		<div id="picDiv" style="display:block;">
			<table border="1" id="pic" cellpadding="0" cellspacing="0" width="100%">
				<tbody>
					<tr>
						<td>
							Picture1
						</td>
						<td>
							<input type="file" name="pic" />
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<span onclick="javascript:writeTd()">Continue...</span>

你可能感兴趣的:(java)