Ciao a tutti...sto provando il getElementByID ma non riesco proprio a farlo andare....per evitare problemi con altri script ho creato un nuovo file html con questo codice:
Però l'alert continua a resituirmi UNDEFINED....come mai? che sbaglio?codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento senza titolo</title> <script> function miaFunz(){ var mioDiv=document.getElementById('mioDiv'); alert(mioDiv.name); } </script> </head> <body> <div id="mioDiv"></div> Prova </body> </html>![]()