rendered paste body<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>...</title>
<script type="text/javascript">
<!--
var answerCounter = 0;
function clone_answer()
{
answerCounter = answerCounter+1;
var node = document.getElementById('answer_1');
var tmpNode = node.cloneNode(true);
alert(answerCounter);
tmpNode.getElementsByTagName('input')[1].value = answerCounter;
var tmpElm = document.createElement('input');
tmpElm.id = null;
tmpElm.type = 'text';
tmpElm.name = 'textfeldname[]';
tmpNode.replaceChild(tmpElm,tmpNode.getElementsByTagName('input')[0]);
document.getElementById('answer_listing').insertBefore(tmpNode, node);
}
function remove_this(obj)
{
obj.form.removeChild(obj.parentNode);
}
//-->
</script>
</head>
<body>
<form>
<fieldset><legend>Competition question</legend>
<p id="question_container"><label for="question">Question<small>(optional)</small></label>
<textarea cols="40" id="sweepstake_question" name="sweepstake[question]" rows="5"></textarea>
</p>
<p id="answer_container"><label for="answer">Answer(s)<small>(optional)</small></label>
<ul id="answer_listing">
<li id="answer_1">
<input id="sweepstake[answer][]" name="sweepstake[answer][]" type="text" />
<input type="radio" name="sweepstake[correct_answer]" value=answer_counter>
</li>
</ul>
</p>
<input value="noch eins" onclick="clone_answer()" type="button" />
</fieldset>
</form>
</body>
</html>