Saturday, May 6, 2017

First Program

In this blog,  I use Notepad++ as the text editor. 
As the browser, Google Chrome or Firefox can be used.
JavaScript statements are placed between <script> …  </script> HTML tags in a web page. The <script> tag alerts the browser program to start interpreting all the text between these tags as a script. <script> tags can be placed anywhere in the web page, but it is recommended to place them between <head> tags.


Let’s try to do a simple script example.




In here you’ll meet some new tags or attributes. Let’s look at what those are.
<!DOCTYPE html>   :  This is not an HTML tag, it is an instruction to the web browser about what version of HTML the page is written in.
<html lang =”en”>  : This is used to declare the language of Web page or web site. In here we use English
<script type=”text/javascript>  :  what script type language we use
<meta charset=”utf-8” />   :  Specify the character encoding for the HTML document
document.write   :   writes a string into the document.This is a statement.
Statement is a instruction that we give to the computer to do something.

If we use  HTML tags between “ “ of document.write statement, then the browser consider these HTML tags as proper HTML tags.

How to run the script ?
  •      Go to ‘Run’ in toolbar
  •     Click ‘Launch in Firefox’
        If you want to run in another browser, select that browser from the menu that come under ‘Run’
Here is the result.





No comments:

Post a Comment