Seguendo un articolo trovato nella sezione javascript di questo sito.. precisamente questo:
http://javascript.html.it/articoli/l...dinamicamente/
sono riuscito a fare ciò che mi serviva, ma adesso incontro un problema.
il javascript:
mi crea un div all'interno della pagina html, che però non ho nell'html stesso..codice:if(document.getElementById && document.createElement){ document.write('<style type="text/css">*.toggle{display:none}</style>'); window.onload=function(){ Attiva("print-img","view print works","hide print works"); } } function Attiva(id,s1,s2){ var el=document.getElementById(id); el.style.display="none"; var c=document.createElement("div"); var link=document.createElement("a"); link.href="#"; link.appendChild(document.createTextNode(s1)); link.onclick=function(){ link.firstChild.nodeValue = (link.firstChild.nodeValue==s1) ? s2 : s1; el.style.display=(el.style.display=="none") ? "block" : "none"; return(false); } c.appendChild(link); el.parentNode.insertBefore(c,el); }
e visto che a me servirebbe il div adattato alle mie esigenze mi chiedo se è possibile dare un id al div che crea il javascript stesso.
spero di esser stato abbastanza chiaro...
grazie in anticipo.