All pastes #516869 Raw Edit

Mine

public html v1 · immutable
#516869 ·published 2007-05-28 21:37 UTC
rendered paste body
<html><head><script type="text/javascript">function addQuestion(){	var question = document.getElementById("templateQuestion").cloneNode(true);	question.id = "";	question.js =	{		index : form.js.nbQuestion + 1	};		var spans = question.getElementsByTagName("span");	for (var i = 0; i < spans.length; ++i)	{		if (spans[i].className == "placeholderNumero")		{			spans[i].innerText = question.js.index;			break;		}	}		form.js.questionContainer.appendChild(question);		++form.js.nbQuestion;}function delQuestion(questionDiv){	// questionDiv.js.index		questionDiv.removeNode(true);	/*	for (var i = questionDiv.js.index + 1; i < form.js.questionContainer.childNodes.length; ++i)	{		form.js.questionContainer.childNodes[i].	}	*/}var form = null;window.onload = function (){	form = document.getElementById("formQuestions");	form.js =	{		nbQuestion : 0,		questionContainer : form.getElementsByTagName("div")[0]	};}</script></head><body><form id="formQuestions" action="test.html" method="post">	<div>	</div>	<a href="javascript://" onclick="addQuestion(); return false;">Ajouter une question</a></form><div style="display:none;">	<div id="templateQuestion">	Question <span class="placeholderNumero"></span> : <input value="" name="questions[]" type="text">	<a href="javascript://" onclick="delQuestion(this.parentNode); return false;">Supprimer</a>	</div></div></body></html>