JavaScript is a scripting language that enhances functionality and appearance of web pages. It allows pages to be more dynamic and interactive through features like form validation, cookies, and animations. JavaScript code is embedded directly into HTML and runs in web browsers and other environments. A basic JavaScript program prints text to a web page. It uses <script> tags to indicate JavaScript code and document.writeln() to output text. User input can be obtained through prompts, which pop up dialog boxes. Variables are used to store and work with input data. The code examples demonstrate basic output and input methods in JavaScript.
2. Introduction (5 Mins) Simple Program: Printing a Line of Text in a Web Page (10 Mins) Prompt Dialogs: Obtaining User Input Dynamic Welcome Page Outline Why & What How
3. Why JavaScript? Enhances functionality and appearance of the web page. Client-side scripting Makes pages more dynamic and interactive Easy-to-use Built into web browsers and other applications Offering functions such as Form validation (JS can be used to validate data before it is submitted to a server. This saves the server from extra processing). JavaScript can be used to set and retrieve web cookies (A JavaScript can be used to store and retrieve information on the visitor's computer). Cool stuff like drop-down menus. Hide and show elements. Animation. JS
5. What is JS? JavaScript is a very popular scripting language on the internet. Cross Platforms. JavaScript language runs inmultiple environments and on many platforms. JavaScript is usually embedded directly into HTML pages. JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Father of JS Brendan Eich
10. Code: Ex.1 html opening tag Usually Java Scripts are included within the head tag, it also could be included in the body tag.
11. Code: Ex.1 html opening tag Usually Java Scripts are included within the head tag, it also could be included in the body tag. One reason JavaScript is so popular is that it's relatively easy to add JavaScript to a web page JavaScript Code block
13. Code: Ex.1 type attribute: Specifies the type of file and the scripting language use.
14. Code: Ex.1 <script> tag: Indicate that the text is part of a script type attribute: Specifies the type of file and the scripting language use. </script> End or Close Tag
15. Code: Ex.1 A Method used to output a string onto the Browser
16. Code: Ex.1 The string, that writeln method takes and printout on the browser. Whatever between the quotations mark will be printed as is. A Method used to output a string onto the Browser
23. JavaScript Data Types and Variables Variable is a facility for storing data. The current value of the variable is the data actually stored in the variable. Variable in JavaScript has name and value Declare a variable give it a name ( ex. var x ) Initialize a variable give it a value ( ex. x = 100) In order to use variable, they must be declared and initialized. Variable types are not important in JavaScript. They may be interchanged as necessary. This means that if a variable is a string one minute, it can be an integer the next. Declare initialize Call
29. Code: Ex.3 writeln method prints the following in the browser: string + value of the variable name + string Hello + name value (input name) + Welcome to JavaScript Programming!