Java Script Copyright Wipro Technologies Talent Transformation Java
- Slides: 31
Java. Script ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Objectives At the end of this session, you will be able to: • Write Java. Script code using all the basic elements of Java. Script Programs • Create Windows & Dialog Boxes • Use the Java. Script’s in-built objects in a web page • Write code that does Event Handling in HTML pages • Manipulate HTML Forms through Java. Script dynamically • Integrate Java and Java. Script through Applets ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
DHTML • DHTML stands for Dynamic Hyper Text Markup Language which helps to add Dynamic content to static HTML pages ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Java Script Java. Script is - An easy to use object scripting language Designed for creating live online applications Code is included as part of a HTML document Scripts are run by the Web browser ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Java. Script Versus Java • Java. Script can be combined directly with HTML • The Java. Script language structure is simpler than that of Java • Java. Script is a purely interpreted language • The Java. Script interpreter is built into a Web browser ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Using the SCRIPT Tag • <HTML> • <HEAD> • <TITLE>Simple Java. Script Example </TITLE> • </HEAD> • <BODY> • HTML Text goes here. • <SCRIPT LANGUAGE="Java. Script"> • document. write("Here is my output. ") • </SCRIPT> • </BODY> • </HTML> ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Elements of Java. Script Program • Elements of Java. Script Program can be divided into five categories, as follows: - ãCopyright Wipro Technologies Talent Transformation Variables Expressions Control Structures Functions Objects and Arrays Java. Script Ver 1. 0 Page
Variables • Data Types • Rules for variable names • Type Casting • Variable Declaration and Scope ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Java. Script Statements • Conditional statements: if. . . else and switch • Loop Statements: for, while, do…while, break and continue • Object Manipulation Statements and Operators: for. . . in, new, this and with • Comments: single-line (//) and multi-line (/*. . . */) ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
switch Statement • A switch statement allows a program to evaluate an expression and attempt to match the expression's value to a case label. If a match is found, the program executes the associated statement. A ‘switch’ statement looks as follows: • switch (expression){ • case label : • statement; • break; • default : statement; • } ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
for Statement • A for loop repeats until a specified condition evaluates to false. A ‘for’ statement looks as follows: • for ([initial-expression]; [condition]; [increment-expression]) { • statements • } ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
do. . . while Statement • The do. . . while statement repeats until a specified condition evaluates to false. A ‘do. . . while’ statement looks as follows: • do { • statement • } while (condition) ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
while Statement • A while statement executes its statements as long as a specified condition evaluates to true. A ‘while’ statement looks as follows: • while (condition) { • statements • } ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Functions • Functions are one of the fundamental building blocks in Java. Script. A function is a Java. Script procedure: a set of statements that performs a specific task. To use a function, you must first define it, then your script can call it. A function definition looks as follows: • function gcd(m, n) • { • return n > 0 ? gcd(n, m%n) : m ; • } ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Objects • An object is a self-contained unit of code having the following characteristics: - Properties - Methods - Identity ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
The Window Object • At the top of the browser hierarchy is the window object, which represents a browser window • The properties/methods of this object are: – – ãCopyright Wipro Technologies Talent Transformation status alert() confirm() prompt() Java. Script Ver 1. 0 Page
The Document Object Represents characteristics of the current HTML page. • Some of its properties are: – title – fg. Color - last. Modified - bg. Color • Some of its methods are: – write() – writeln() • In the browser object hierarchy, the document object is contained in a window object (for a page without frames) ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
The Form Object • Represents an HTML Form. • Has the same name as the NAME attribute in the FORM tag • In the browser object hierarchy, the form object is contained in the document object ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Frame Objects • Each Frame in a frame set is represented as a frame object • A frame set contains an array of frame objects representing all the frames in it • You can refer to a particular frame : - By name - if it has one - By reference to the parent and the array index of that frame ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
The Math Object • The Math object can’t be created, since it exists automatically in all Java Script Programs • Its properties represent mathematical constants • Its methods are mathematical functions ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
The String Object • Any String variable in Java. Script is a String object. It has a property – Length and – Many Methods ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
The Date Object • Is built-in Java. Script object • Create using new keyword ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Defining Objects The object definition is a simple function that accepts parameters to initialize a new object and assigns those to the corresponding properties ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Looping through Object’s properties • The final statement used for object-oriented work in Java. Script is the for. . . in loop • This loop executes once for each property of an object, assigning the index variable to the property name ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Arrays • Java. Script doesn’t support array variables • Arrays need to be created using array object ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Events • Are things that happen to the browser • Used to trigger portions of program • Pertain to the web page containing the script ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Event Handlers • Embedded in HTML tags as part of anchor and links or any of the form element tags ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Time Outs • Statements that will be executed after a certain amount of time elapses • Handy for periodically updating a Web Page or for delaying the display of a message or execution of a function ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Integrating Java. Script with Java • Each Java applet you embed in a Web page is made available to Java. Script as an applet object, with the same name as the applet's class name • The applet object resides in the object hierarchy under the document object – For example, a Java applet called Scroll would be accessed through an object called document. Scroll • The objects, properties, and methods of the applet are then available to Java. Script, provided the Java programmer has made them public ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Creating Windows • Opening new browser windows is a great feature of Java. Script • You can either load a new document (for example a HTML-document) to the new window or you can create new documents (on-the-fly) ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
Summary In this session, you have learnt to: • Write Java. Script code using all the basic elements of Java. Script Programs • Create Windows & Dialog Boxes • Use the Java. Script’s in-built objects in a web page • Write code that does Event Handling in HTML pages • Manipulate HTML Forms through Java. Script dynamically • Integrate Java and Java. Script through Applets ãCopyright Wipro Technologies Talent Transformation Java. Script Ver 1. 0 Page
- Talenttransformation.wipro com
- Talenttransformation.wipro.com
- Script de java
- Data types in javascript
- Java script wikipedia
- "java script"
- "java script"
- "java script"
- Java script course
- Java script
- "java script"
- Hopper khan academy
- Java script examples
- Inside which element do you put javascript
- Java script email
- Java script ide
- "java script"
- "java script"
- Java script classes
- Wipro bucharest
- Unix cpp sys wipro
- Sap iisc
- Wipro share history 1980
- Wipro share price in 1980
- Vd screen wipro
- Wipro perniö
- Wipro
- Wipro case study
- Wipro
- Vincent nair
- Adid wipro
- Ddo template v4