Download presentation
Presentation is loading. Please wait.
Published byMatthew Cummings Modified over 9 years ago
1
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part One
2
© 2000 – All Rights Reserved - Page 2 What is JavaScript? An interpreted programming language Inserted into HTML code Controls the actions of a browser Adds dynamics and interactivity –Scrolling messages –Animations and dynamic images –Data input forms –Pop-up windows (Alerts) –Interactive quizzes
3
© 2000 – All Rights Reserved - Page 3 Origins of JavaScript Joint venture of Sun & Netscape (AOL) –Sun was simplifying Java –Netscape was developing LiveScript Open language – no license required Microsoft’s version is called JScript
4
© 2000 – All Rights Reserved - Page 4 It can and cannot… It can and cannot… Can control browsers Cannot create graphics Can enhance HTML Cannot stand alone as an application Cannot create applets (small programs)
5
© 2000 – All Rights Reserved - Page 5 T-A-V…HTML Revisited Tag is a markup instruction surrounded by signs Attributes are characteristics of a Tag Values are assigned to Attributes Figure I-1, Page I.3
6
© 2000 – All Rights Reserved - Page 6 SCRIPT Tags SCRIPT Tags Inform the browser you’re incorporating a script into the HTML page Create one or more Script Sections Case-sensitive…VERY case-sensitive! More fussy than HTML Figure I-3, Page I.4
7
© 2000 – All Rights Reserved - Page 7 JavaScript v. VBScript JavaScript similar to C VBScript similar to Visual Basic JavaScript uses functions VBScript uses subroutines Internet Explorer runs JavaScript Navigator won’t run VBScript
8
© 2000 – All Rights Reserved - Page 8 Why Use JavaScript? Why Use JavaScript? Adds interactivity to a web page Easier than a CGI script It’s client-side…faster response Lots of freebies available…beware
9
© 2000 – All Rights Reserved - Page 9 CookiesCookies Remember your name, etc. Remember your preferences Enable web pages customized for you Identify dead-ends Scare paranoid people
10
© 2000 – All Rights Reserved - Page 10 Variables, Literals, and Expressions…Oh My! A variable represents a value stored in memory for later use by the script A literal is an actual number of character string…not a calculated value An expression is a formula or a way to assign values to variables
11
© 2000 – All Rights Reserved - Page 11 Variable Types Variable Types Numeric String Boolean Define Need Not Declare
12
© 2000 – All Rights Reserved - Page 12 Rules for Naming Variables Must begin with letter or underscore No spaces or punctuation Avoid reserved words (ref. p. A.1) Case sensitive Page I.6
13
© 2000 – All Rights Reserved - Page 13 Literal Types Literal Types Numeric String Special codes Figures I-4, 5, 6 Pages I.6-7
14
© 2000 – All Rights Reserved - Page 14 Expressions Expressions A formula or a way to assign values to variables Use a combination of variables and literals First calculate the right side Then store the result in the left Figures I-7a & 7b, Page I.7
15
© 2000 – All Rights Reserved - Page 15 Arithmetic Operators Page I.8
16
© 2000 – All Rights Reserved - Page 16 Order of Precedence Page I.9
17
© 2000 – All Rights Reserved - Page 17 Test Your Knowledge Test Your Knowledge Page I.17 True/False Questions 1-5 Multiple Choice Questions 1-6
18
© 2000 – All Rights Reserved - Page 18 Introduction to JavaScript Programming Part One
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.