1.

How to create a Number object using JavaScript?

Answer»

<P>The document.write() method writes JavaScript code to a document. It also writes HTML EXPRESSIONS.

The syntax:

document.write(expression1, expression2, expression3, ...)

Here, expression1, expression2, expression3 are the expressions to be written to the OUTPUT stream.

Let us now see an example to write HTML elements with document.write():

<!DOCTYPE html> <html> <body> <script> document.write("<p>John CENA</p>"); </script> </body> </html>

The output:

John Cena

Let us see another example to write text to stream with document.write():

<!DOCTYPE html> <html> <body> <script>   document.open();   document.write("<p>TRAVIS Head</p>");   document.close(); </script> </body> </html>

The output:

Travis Head


Discussion

No Comment Found