Download presentation
Presentation is loading. Please wait.
Published byJean Sherman Modified over 9 years ago
1
Introduction
2
The scripting language most often used for client-side web development. Influenced by many programming languages, easier for nonprogrammers to work with. Best known for its use in website development. Unrelated to Java programming -- although both have a common C syntax Supports all the structured programming syntax in C, Java, C#. – variables, conditionals, repetition structures, data structures, classes
3
Primary use is to write function that are embedded in HTML pages: Examples: popping up a new window with control over size, position, attributes. Validation of web form input values to make sure they are acceptable before submitting to server. Changing images as a mouse moves over them. The JavaScript interpreter interprets JavaScript source code and execute the script accordingly. not a compiled language like C or C++ Most common host environment for JavaScript is a web browser
4
JavaScript is object based Client side scripting – runs on browser, not on server Don't need to send and retrieve data to the server Saves time Does not need to be compiled Script interpretation done by browser
5
To tell html you will be using JavaScript do this: …. Everything between the opening and closing tags is JavaScript Browser treats code as scripting language not html Place inside head tag, the browser interprets first so the JavaScript will execute before the body
6
If placed in tag, it gets run first If placed in tag, runs in order it was placed JavaScript can be placed in an external file External JavaScript files end with.js extension
7
document.write(“hello world!"); alert(‘hello world’); “hello world” is a character string - a string of characters contained between double or single quotes parentheses following the name of the method containing the arguments that the method requires to perform its task. Every statement should end with a semicolon (not required but a programming standard). JavaScript is case sensitive method write() – write a line of text
8
Good practice to comment your code – explain what your code does Comments – ignored by the browser One line comment // This is a one line comment Multi-line comment /* this is a multi-line comment I have a lot to explain */
9
In Chrome – JavaScript Debugger is F12 or CTRL, shift J In Firefox, use the error console (CTRL, Shift, J) Provides clear description of errors Identifies the line in your code where error occurred
10
Fade in practice chapter1 – 1.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.