Presentation is loading. Please wait.

Presentation is loading. Please wait.

JavaScript and Ajax (JavaScript Basic) Week 2 Web site:

Similar presentations


Presentation on theme: "JavaScript and Ajax (JavaScript Basic) Week 2 Web site:"— Presentation transcript:

1 JavaScript and Ajax (JavaScript Basic) Week 2 Web site: http://fog.ccsf.edu/~hyip

2 JavaScript Basic JavaScript (aka ECMAScript) is an interpreted, object-based, scripting, loosely typed, case sensitive language There are three favors of JavaScript:  Core JavaScript: makes up of the JavaScript language  Client-side JavaScript (CSJS) = Window Object [Navigator + DOM] + Core JavaScript  Server-side JavaScript (SSJS) = compiler + Core JavaScript [HTML+JS – compiler – JS Byte code – JS interpreter – HTML]

3 JavaScript Basic (continue…) Dot notation object_name.property_name e.g. pen.inkColor = blue; document.body.style.color = red; object_name.method() e.g. pen.write("Hi"); document.write("Hello"); [See JS basic]JS basic Character set = 16-bit Unicode encoding JavaScript is case-sensitive language e.g. Document.Write("Hello"); //NOT OK JavaScript ignores white space (space, tab, new line) var a = "abc"; // OK var b = "a bc"; // NOT OK JavaScript comments // single line comment /* multiple line comments */

4 JavaScript Basic (continue…) Literals = Data value Identifiers = name (variable name, function name, label name) Identifier rules: 1)First character must be letter, or underscore (_) 2)Subsequent characters can be letter, digit, or underscore Variable declare and assign data var variable_name = "ABC"; var my_num = 123; JavaScript reserved words = words that make up of the JavaScript language. (e.g. if, else, while)

5 JavaScript Basic (continue…) Embedded JavaScript // JavaScript coding here External JavaScript [See JavaScript sample]JavaScript sample

6 JavaScript Basic (continue…) JavaScript can be in… 1. section 2. section 3.Inline with HTML as an event handler (onload, onunload, onchange, onclick, onmouseover, onmouseout) 4.Exernal JavaScript file (dir/ext_file.js) 5.Inline using JavaScript Pseudo-protocol   Or go to URL: javascript: var now = new Date(); document.write(now);


Download ppt "JavaScript and Ajax (JavaScript Basic) Week 2 Web site:"

Similar presentations


Ads by Google