Non va bene perché quella riga è dentro una stringa, ho provato a scriverla così
ma il form viene inviato subito senza aspettare l'onclick.codice:+"<input type='button' onclick='"+form.submit()+"' value='Ok' />"
Alla fine ho assemblato con i metodi del W3C invece che con innerHTML e tutto funziona, grazie comunque.
codice:function showConfirm (addressNo, txt, form) { var newObj = document.createElement ("DIV"); newObj.setAttribute ("id", "msg"); var p = document.createElement ("P"); var b1 = document.createElement ("INPUT"); b1.setAttribute ("type", "button"); b1.onclick = function () { form.submit (); } b1.setAttribute ("value", "Ok"); p.appendChild (b1); p.appendChild (document.createTextNode (" ")); var b2 = document.createElement ("INPUT"); b2.setAttribute ("type", "button"); b2.onclick = function () { location.href = addressNo; } b2.setAttribute ("value", "Annulla"); p.appendChild (b2); newObj.appendChild (p); newObj.appendChild (document.createTextNode (txt)); document.getElementById ('container').appendChild (newObj); }![]()

Rispondi quotando