Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scripting Language A scripting language or script language is a programming language that supports the writing of scripts. The term script is typically.

Similar presentations


Presentation on theme: "Scripting Language A scripting language or script language is a programming language that supports the writing of scripts. The term script is typically."— Presentation transcript:

1

2 Scripting Language A scripting language or script language is a programming language that supports the writing of scripts. The term script is typically reserved for small programs (up to a few thousand lines of code). Scripting languages, which can be embedded within HTML, commonly are used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic advertisements. These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window. 2

3 JavaScript JavaScript is a scripting language that enables web developers/designers to build more functional and interactive websites. Common uses of JavaScript include: I.Alert messages II.Popup windows III.Dynamic dropdown menus IV.Form validation V.Displaying date/time 3

4 THE FIRST SCRIPT Knowing that JavaScript needs to be entered between tags, is a start. But there are a few other things you need to know before writing your first JavaScript: 1.JavaScript lines end with a semicolon. 2.Always put the text within " ". 3.Capital letters are different from lowercase letters. Note:-Incorrect capitalization is probably the most common source of error for JavaScript programmers on all levels!! 4

5 THE FIRST SCRIPT document. write("JavaScript is not Java"); 5

6 Document object The document object is one of the most important objects of JavaScript. Shown below is a very simple JavaScript code: document.write("Hi there.") In this code, document is the object. write is the method of this object. ---------------------------------------------------------------- Let's have a look at some of the other methods that the document object possesses. 6

7 lastModified You can always include the last update date on your page by using the following code: document.write("This page created by Iltaf Mehdi. Last update:" + document.lastModified); All you need to do here is use the lastModified property of the document. Notice that we used + to put together This page created by John N. Last update: and document.lastModified. 7

8 bgColor and fgColor Lets try playing around with bgColor and fgColor: document.bgColor="black“; document.fgColor="#336699“; 8

9 WHERE TO PLACE IT Since JavaScript isn't HTML, you will need to let the browser know in advance when you enter JavaScript to an HTML page. This is done using the tag. You can place your scripts in any of the following locations: 1.Between the HTML document's head tags. 2.Within the HTML document's body (i.e. between the body tags). 3.In an external file (and link to it from your HTML document). 9

10 External JavaScript File You can place all your scripts into an external file (with a.js extension), then link to that file from within your HTML document. This is handy if you need to use the same scripts across multiple HTML pages, or a whole website. 10

11 External JavaScript File To link to an external JavaScript file, you add a src attribute to your HTML script tag and specify the location of the external JavaScript file. <script type="text/javascript“ src="external_javascript.js"> 11


Download ppt "Scripting Language A scripting language or script language is a programming language that supports the writing of scripts. The term script is typically."

Similar presentations


Ads by Google