Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
If you are looking for Web Programming course, you are at right place. This lecture key words are: Javascript, Javascript Background, Purpose of Javascript, Javascript Syntax, History Lesson, Dynamic Html, Client Side Data Entry Validation, Client Side Cgi, Process and Manage Cookies, Creating a First Script
Typology: Slides
1 / 56
JavaScript background The purpose of JavaScript JavaScript syntax
JavaScript is NOT Java Started at Netscape in 1995 Microsoft released its own version 'JScript" in 1996 JavaScript is the default scripting language in .NET (VBScript has pretty much faded away)
A starter list Adds sizzle to pages (Animation) Dynamic HTML (DHTML) Client side data entry validation Client side CGI Reduce the load on overburdened servers Process and manage cookies Some servers are beginning to support JavaScript AJAX to load parts of Web pages
It‟s a programming language that „closely‟ resembles Java Implementations European Computer Manufacturers Association created ECMAScript to standardize different scripting versions See ECMA- I‟ll try to conform There are others It‟s a “C ish” language
Most of what we do is access the object model supported by the underlying browser The W3C defines the Document Object Model (DOM) Differences do exist between browsers I will try, where possible, to point out these differences Most support the common ECMA standards though
tag appears in a or tag type argument denotes that it‟s JavaScript Example:
****
**
**
script tag
Script tag
Script language
A document may have multiple blocks Scripts in a block Create procedures here Before or after the section is fine Scripts in a block Code executes as the page is rendered Importing external script files This is the recommended place to put generic functions
Scripts appearing in a tag but outside a procedure execute first in the order they appear More about procedures later Code in a procedure is not executed unless explicitly called Scripts appearing in a tag execute as they are encountered The placement has an effect on page rendering
Include the directive to display a message when JavaScript is disabled
**
** Semicolons need not terminate statements although they do no harm Unless two statements are placed on the same line Variables var data type is generic JavaScript is not strongly typed like Java Type conversion happens on the fly Other types number , boolean , string , function , object
See JavaScriptExample1.htm
Pay particular attention to the order in which the script code executes
Comments appear differently inside of JavaScript block that outside of a JavaScript block The characters // on a line mark the line as a comment The strings /* and */ mark the begin and end of a multi-line comment
**
** JavaScript is “loosely typed‟ data types change dynamically as the program runs Declare variables with the var statement
Examples
var x // Now x is undefined var x = 5; // Now x is a Number var x = "John"; // Now x is a String
Like VB, there are local and global variables Local variables are declared inside of a procedure Global variables are declared in a **
Functions execute when called Call functions explicitly from other JavaScript code Call functions implicitly from an event handler
From another function or from within another JavaScript block, call the function with it‟s name an parameters
Example: ****
Call the return statement with an argument as in
return 0;