document.write ()




Usare document.write ()
A scopo di test, e' conveniente usare document.write():

Esempio
<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
<p>My first paragraph.</p>

<script>
document.write(5 + 6);
</script>

</body>
</html>

L'utilizzo di document.write () dopo il caricamento di un documento HTML eliminera' tutto il codice HTML esistente :

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>
<p>My first paragraph.</p>

<button type="button" onclick="document.write(5 + 6)">Try it</button>

</body>
</html>
Il metodo document.write () dovrebbe essere usato solo per i test.










( documentwrite.html )- by Paolo Puglisi - Modifica del 17/12/2023