En este código, quiero insertar algo de HTML y texto normal en JavaScript y no quiero que siempre ingrese document.write(" al comienzo de cada línea de esta manera:
document.write ("<Style>"); document.write ("html {height:100%}"); document.write (".header {background-color: Aliceblue}"); document.write ("</Style>"); document.write ("<Div class='header'>Website Name</div>"); document.write ("<P style='color:red'>Some text i gathered here</p>");Sería de gran ayuda si alguien pudiera resolver este problema o darme alguna alternativa.😊😊😊
document.write(` <style> html {height:100%} .header {background-color: Aliceblue}" </style> <div class="header">Website Name</div> <p style="color:red">Some text i gathered here</p> `) <script> function write(data) { document.write(data) } </script> ... <script> write("<style>"); write("html {height:100%}"); ... </script>Advertencia:
<Style> -> wrong <style> -> ok "<div class="header">Website Name</div>" -> err "<div class='header'>Website Name</div>" -> ok