Jump to content

Create dtnamic html fields


abch624

Recommended Posts

Hi Guys,

 

I have a table that is pretty simple and stright forward

<table border="0" cellpadding="0" cellspacing="0" width="1000" align="center">
<tr>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="200" height="70" align="center">
			<tr>
				<td colspan="8" class="formHead">Personal Details</td>
			</tr>
			<tr>
				<td class="formField">
					Name
				<td>
				<td class="formField">
					DOB
				<td>
				<td class="formField">
					AIMS ID
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="350" align="center">
			<tr>
				<td colspan="6" class="formHead">
					Completed studies (subjects)*
				</td>
			</tr>
			<tr>
				<td class="formField">
					GCSE's grades
				<td>
				<td class="formField">
					A-levels or GNVQ or equivalent
				<td>
				<td class="formField">
					University and Level/Degree (inc vocational studies eg city & guilds, BTEC etc)
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="300" align="center">
			<tr>
				<td colspan="6" class="formHead">
					Current studies (institution, subject & level)
				</td>
			</tr>
			<tr>
				<td class="formField">
					Subject
				<td>
				<td class="formField">
					Level/Degree (inc vocational studies eg city & guilds BTEC etc)
				<td>
				<td class="formField">
					Institute
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="150" height="70" align="center">
			<tr>
				<td colspan="6" class="formHead">
					Career guidance
				</td>
			</tr>
			<tr>
				<td class="formField">
					Are you employed?
				<td>
				<td class="formField">
					Do you require guidance?
				<td>
			</tr>
		</table>
	</td>
</tr>
<tr>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="200" height="50" align="center">
			<tr>
				<td class="formField">
					Name
				<td>
				<td class="formField">
					DOB
				<td>
				<td class="formField">
					AIMS ID
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="350" height="50" align="center">
			<tr>
				<td class="formField">
					GCSE's grades
				<td>
				<td class="formField">
					A-levels or GNVQ or equivalent
				<td>
				<td class="formField">
					University and Level/Degree (inc vocational studies eg city & guilds, BTEC etc)
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="300" height="50" align="center">
			<tr>
				<td class="formField">
					Subject
				<td>
				<td class="formField">
					Level/Degree (inc vocational studies eg city & guilds BTEC etc)
				<td>
				<td class="formField">
					Institute
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="150" height="50" align="center">
			<tr>
				<td class="formField">
					Are you employed?
				<td>
				<td class="formField">
					Do you require guidance?
				<td>
			</tr>
		</table>
	</td>
</tr>
</table>

 

Now what I want to be able to do is that on a click of a button add the bellow part of the table again and again (depends how many times the button is invoked).

<tr>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="200" height="50" align="center">
			<tr>
				<td class="formField">
					Name
				<td>
				<td class="formField">
					DOB
				<td>
				<td class="formField">
					AIMS ID
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="350" height="50" align="center">
			<tr>
				<td class="formField">
					GCSE's grades
				<td>
				<td class="formField">
					A-levels or GNVQ or equivalent
				<td>
				<td class="formField">
					University and Level/Degree (inc vocational studies eg city & guilds, BTEC etc)
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="300" height="50" align="center">
			<tr>
				<td class="formField">
					Subject
				<td>
				<td class="formField">
					Level/Degree (inc vocational studies eg city & guilds BTEC etc)
				<td>
				<td class="formField">
					Institute
				<td>
			</tr>
		</table>
	</td>
	<td>
		<table border="1" cellpadding="0" cellspacing="0" width="150" height="50" align="center">
			<tr>
				<td class="formField">
					Are you employed?
				<td>
				<td class="formField">
					Do you require guidance?
				<td>
			</tr>
		</table>
	</td>
</tr>
</table>

 

Please help guys I have used javascript but not good at it!!

 

cheers - zahid

Link to comment
Share on other sites

Try something like the following:

 

<table id="addtable">
<tr><td>.... The original table content ....</td></tr>
</table>

<script type="text/javascript">
function addRow()
{
document.getElementById("addtable").innerHTML += "<tr><td>.... The row to add ....</td></tr>";
}
</script>
<input type="button" onclick="addRow()" value="Add"> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.