Hello I am creating website using php.In that i have one form which is for add appointment. in that page user can fillup date, start Time and End time of appointment. but if user want to add extra date and time he/she can also add. for that i have write following code.
<div id="date">
<table>
<tr>
<td>
Date<br>
<input type="text" id="dateid">
</td>
<td>startTime:<select><option value="00:00">00:00</option></select></td>
<td>EndTime:<select><option value="00:00">00:00</option></select></td>
<td><input type="button" value="Extra Time" onClick="addTime()"></td>
</tr>
</table>
</div>
for onlick event i have create on function.
<script>
function addTime()
{
var timeDiv='<div id="extraTimeDiv"><table><tr><td>Date<br><input type="text" id="extradate"></td><td >Start Time</td><td><select id="addstart" name="addstart"><option value="00:00"> 00:00</option><option value="00:30"> 00:30</option><option value="01:00"> 01:00</option><option value="01:30"> 01:30</option><option value="02:00"> 02:00</option> EndTime:</td><td ><select id="addend" name="addend"><option value="00:00"> 00:00</option><option value="00:30"> 00:30</option><option value="01:00"> 01:00</option><option value="01:30"> 01:30</option><option value="02:00"> 02:00</option></select></td><td></td></tr></table></div>'
var div = document.getElementById('date');
div.innerHTML = div.innerHTML + timeDiv;
}
</scritp>
this works fine but when when i click on more then previous selected data erased. data should be as it is when i press more to add extra time. kidnly help me how to solve this problem? Thank you in advance.