funzionacodice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <style type="text/css"> <!-- --> </style> <script language="JavaScript" type="text/javascript"> <!-- function selezionaCliente(val){ alert(val) } function addSelect(){ var select = document.createElement("select"); select.setAttribute("name","linea"); select.className="select"; select.style.marginLeft="9px"; var option1 = document.createElement("option"); var t1 = document.createTextNode("a"); option1.setAttribute("value","a"); option1.appendChild(t1); select.appendChild(option1); var option2 = document.createElement("option"); var t2 = document.createTextNode("b"); option2.setAttribute("value","b"); option2.appendChild(t2); select.appendChild(option2); var option3 = document.createElement("option"); var t3 = document.createTextNode("c"); option3.setAttribute("value","c"); option3.appendChild(t3); select.appendChild(option3); var option4 = document.createElement("option"); var t4 = document.createTextNode("d"); option4.setAttribute("value","d"); option4.appendChild(t4); select.appendChild(option4); var divUltimoCampo = document.createElement("div"); divUltimoCampo.className="ultimoCampo"; divUltimoCampo.setAttribute("id","ultimoCampoCliente"); document.getElementById('mioForm').appendChild(select) divUltimoCampo.innerHTML = "<a href=\"#\" onclick=\"selezionaCliente(document.mioForm.linea.options[document.mioForm.linea.selectedIndex].value);\">seleziona cliente</a>"; document.getElementById('mioForm').appendChild(divUltimoCampo) } //--> </script> </head> <body> <form name="mioForm" id="mioForm"> <input type="button" onclick="addSelect()"> </form> </body> </html>