Ti ringrazio per la risposta
Ho capito ciò che mi avete detto ed ho cercare di formulare il tutto e sembra andare, potete cortesemente buttarci giusto un'occhio?Grazie!!
<script type="text/javascript">
function cambio(){
n=prompt("Quanti elementi P vogliono essere creati?");
tagp=document.getElementsByTagName("p");
iid=tagp.length+1;
contenuto=document.getElementById("contenuto");
if (isNaN(n))
alert("Intendo un numero!");
else{
tot=n-tagp.length;
for (c=0;c<tot;c++){
frase=prompt("Inserire frase numero " + iid);
p=document.createElement("p");
p.setAttribute("id",iid);
p.setAttribute("align","center");
p.appendChild(document.createTextNode(frase));
contenuto.appendChild(p);
iid=iid+1;
}
}
}
function rimuovi(){
n=prompt("Quanti elementi P vogliono essere eliminati?");
tagp=document.getElementsByTagName("p");
x=tagp.length;
for (c=0;c<n;c++){
contenuto.removeChild(document.getElementById(x));
x=x-1;
}
}
</script>