Dynamic Form

I want to create a dynamic form like this :wink:

but I cant
may you help me please
I write this code :confused: but it works incorrect :blush:
plz help me
i spend 3 day time to solve this
but i cant

var i ;
function Form(formName)
		var newform = document.createElement('form');
		newform.innerHTML = "<br>Form " + (i + 1) + "<br>\\
		<span >\\
				<input type='button' value='New Form' onClick=\\"Form('Form')\\" >"+" "+"\\
				<input type='button' value='New Row'onClick=\\"Row('Row')\\" >"+" "+"\\
				Input Text: <input type='text' name='firstname' />"+" "+"\\
		newform.className= "form"+i;
function Row(spanName)
		var newspan = document.createElement('span');
		newspan.innerHTML = "<br>Form "+ i +" Row " + (j + 1) + "<br>\\
			<input type='button' value='New Form' onClick=\\"Form('Form')\\" >"+" "+"\\
			<input type='button' value='New Row' onClick=\\"Row('Row')\\" >"+" "+"\\
			Input Text: <input type='text' name='firstname' />"+" "+"\\

<script src="javascript.js" language="Javascript" type="text/javascript"></script>
<div id="Form">
	<form class="form1"method="POST">
		Form 1<br/>
		<span id="Row">
				<input type="button" value="New Form" onClick="Form('Form')"/>			
				<input type="button" value="New Row"  onClick="Row('Row')"/>
				Input Text: <input type="text" name="firstname" />
					<option value=""></option>

I don’t understand from the image what you are trying to achieve.
Can you provide further details about what it is that you need help with?

I want a form that when click on each button create new row
if click on Square a new row separated
if click on circle a new row that is child

excuse me for my bad English