Category: Education

Presentation Description

No description available.


Presentation Transcript

JavaScript : 

JavaScript By Mr.K.Venkateswara Rao. Assistant. Professor C.M.R College Of Engineering & Technology Hyderabad Andhra Pradesh


INTRODUCTION What is JavaScript? A Scripting language that is designed primarily for people who are building WebPages using HTML. JavaScript programs are embedded within HTML documents in source code form. The script is interpreted by browser .Platform independence

Slide 3: 

JavaScript code added to HTML can perform a wide variety of functions 1)Decision making 2)Submitting forms 3)Performing complex calculations 4)data entry validations etc.

Slide 4: 

JavaScript is an object oriented. It allows interaction with the properties of objects that it recognizes. Internal built-in objects(e.g. window object). Browser object(e.g. document object). JavaScript programs can run both on the client and the server sides Client side: By the browser after downloading the HTML document. Server side: Requires Netscape livewire environment.

Slide 5: 

Although the names resembles quite closely, they are different languages Some facts: 1.Both are object oriented languages. 2.Java script programs are interpreted in source code form. 3.Java programs are first compiled into a device independent byte code format, which is then interpreted.

Slide 6: 

4.Javascript is a small language and does not have many features that exist in java. 5.Java is a powerful language can be used in extremely sophisticated applications. 6.Javascript is loosely typed language. 7.Java is strongly typed language. 8.Javascript is comparatively easier to understand. 9.Difficult for a common man to understand this language.

Slide 7: 

10.Javascript enables faster creation of web pages. 11.Creation of web pages takes longer time.

In the context of JavaScript : 

In the context of JavaScript An object is collection of properties and methods which can be viewed, modified and interacted with. Variable1 Variable2 Variable3 . . Function1 Function2 Function3 . . object

Slide 9: 

A simple example of property is color, which rather easy to visualize. They can be directly manipulated by referring to the object and the property by the name and then setting it’s value. For example, the background color of a page can be changed as : document.bgcolor=“blue”;

Slide 10: 

In the object oriented paradigm, methods refer to functions that can be used to manipulate objects and their properties. Example: the methods write(),which when invoked on the document object causes a specific strong of characters to outputted. document. write(“hello good day”);

Slide 11: 

Methods which are defined on an object give the range of choices available for interacting with the object. some examples: 1.A window object can be opened or closed using the open() and close() methods respectively. 2.A form object has a submit() method which transmits the contents of the form to the web server.

Slide 12: 

3.History object ,which has forward() and backward() methods to move through the list. Apart from the pre-defined methods it is also possible to create userdefine functions. 1.Control the rate with which a line of text scrolls across the screen. 2.Determine the path of an animated object across the display. Event handlers can be coded in JavaScript

Running scripts: : 

Running scripts: Scripts written in JavaScript most either be embedded within a html document, or be referenced as an external file which loaded with the HTML document. ---- ---- ---- Jscode ---- ---- Jscode ----- ----- ----- ---- ---- ---- ----------- ------------ ----- ----- ------------- ------------- ----- -----

Slide 14: 

All recent browsers can detect and interpret JavaScript code directly. The <script> tag is used. <script language=“JavaScript”> ---------- ---------- ---------- </script>

Slide 15: 

Language =“JavaScript” is optional . For browsers that do not understand javascript,it is possible to use the HTML comment tag “<!—”and”-- >” to bracket out the JavaScript code 1.The marked block is treated as hidden by the browsers that do not understand JavaScript. 2.These tags are ignored by browsers that can interpret JavaScript.

A typical HTML page: : 

A typical HTML page: <html> <head> <title>example</title> <script language=“JavaScript”> <!– ----- ----- -- > </script></head><body>----</body></html>

Example 1 : 

Example 1 Simple message output varying in sizes. 1.<html> 2.<head> <title>example1</title> </head> <body> <script type=“JavaScript”> Document.writeln(“<h1>hello good day</h1>”); Document.writeln(“<h3>best of luck</h3>”); </script> <body></html>

authorStream Live Help