a parte che non ho capito come fai ad assegnare l'evento onclick su un elemento se prima non lo appendi da qualche parte con un appendchild, ad ogni modo
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>xhtml 1.0</title> <script type="text/javascript"> // <![CDATA[ function test() { for(var t=1;t<=3;t++){ var nuovosel=document.createElement("select"); document.body.appendChild(nuovosel); nuovosel.onclick=(function(index) { return function() { //alert("prova"+index); invia_dati("prova"+index); } })(t); } } window.onload = test; // ]]> </script> </head> <body> </body> </html>
e riguarda attentamente gli esempi che ti ho indicato nel link precedente

Rispondi quotando