Category: Vanilla Javascript

Added: 14th of October 2018

Viewed: 2027 times

Javascript document.write(). Javascript for begineers

If your going to use jquery, or some of the new javascript frameworks and never programmed with javascript before, it's a good idea to learn the basics first, or what they call today Vanilla Javascript.

Over the years I never spent enough time learning to programme in Javascript, and probably like a lot of other users found code online and modified it to fit my needs. That always left me feeling annoyed as it didn't give me a proper understand of the how the script worked, and if I wanted to take the script further I couldn't do it.

I have set myself a challenge to learn some Javascript. I will be adding some examples with explanations for my own reference on the site, and hope that it will come in useful to other users wishing to learn Javascript.

Where to start
One thing I love about Javascript is the ability to write scripts using just a plain text editor, and test it locally in your web browser without the need to upload it to a server, like you would with server side languages such as .php.

Creating a simple javascript is simple, which brings me to the first example, using the document.write() command to out a simple message to your screen.

Example 1: Using document.write() command in Javascript
Create a new .html document on your desktop, and rename the file example1.html

Open the document in your text editor and copy and paste the following code.

document.write("My Computer Tips");

Save the document and open it in your webbrowser. My Computer Tips will be printed to the screen.

Other Tips & Tutorials

Vanilla Javascript

Display date and time using Javascript

Posted: 25th of July 2021

Views: 235

Vanilla Javascript

Clear all form fields using Javascript

Posted: 25th of October 2020

Views: 1083

Vanilla Javascript

Generate a random number between 1 and 5 using Math.floor and Math.random commands in Javascript

Posted: 22nd of October 2018

Views: 1839

Vanilla Javascript

Using document.getElementByID() in javascript to send form data

Posted: 15th of October 2018

Views: 1683

Vanilla Javascript

Using document write() in javascript.

Posted: 14th of October 2018

Views: 2027