javascript

14
Introducing JavaScript Introducing JavaScript by by Rama Krishnam Raju Rama Krishnam Raju

Post on 11-Sep-2014

6 views

Category:

Documents


1 download

DESCRIPTION

Presentation on Java Script

TRANSCRIPT

Page 1: Javascript

Introducing JavaScriptIntroducing JavaScript

bybyRama Krishnam RajuRama Krishnam Raju

Page 2: Javascript

JavaScript is the scripting language of the Web.

JavaScript is used in billions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more.

JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera.

Page 3: Javascript

What You Should Already Know.

Before you continue you should have a basic understanding of the following: HTML .

What is JavaScript? JavaScript was designed to add interactivity to HTML pages. JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means that scripts

execute without preliminary compilation) Everyone can use JavaScript without purchasing a license

Page 4: Javascript

IntroducingIntroducing JavaScriptJavaScript

Are Java and JavaScript the same? NO!. Java and JavaScript are two completely different languages in

both concept and design! Java (developed by Sun Microsystems) is a powerful and much

more complex programming language - in the same category as C and C++.

Learning JavaScript? Special syntax to learn!. Learn the basics and then use other people‘s(lots of free sites) Write it in a text editor, view results in browser You need to revise your HTML

Page 5: Javascript

IntroducingIntroducing JavaScriptJavaScript

What can a JavaScript do? JavaScript gives HTML designers a programming tool - HTML

authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into

their HTML pages. JavaScript can put dynamic text into an HTML page - A JavaScript

statement like this: document. write("<h1>" + name + "</h1>") can write a variable text into an HTML page

JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element

JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing

Page 6: Javascript

Introducing JavaScriptIntroducing JavaScript

Arithmetic Operators

Arithmetic operators are used to

perform arithmetic between variables and/or values.

The following table explains the arithmetic operators

Page 7: Javascript

Introducing JavaScriptIntroducing JavaScript

Assignment Operators

Assignment operators are used to assign values to JavaScript variables.

The following table explains the assignment operators

Page 8: Javascript

Introducing JavaScriptIntroducing JavaScript

Comparison Operators

Comparison operators are used to compare values to JavaScript variables.

The following table explains the Comparison operators

Page 9: Javascript

Introducing JavaScriptIntroducing JavaScript

Logical Operators

Logical operators are used to compare logical values to JavaScript variables.

The following table explains the Logical operators

Page 10: Javascript

IntroducingIntroducing JavaScriptJavaScript

How to Put a JavaScript Into an HTML Page?

<html>

<body>

<script type="text/javascript">

document.write("Hello World!")

</script>

</body>

</html>

Page 11: Javascript

IntroducingIntroducing JavaScriptJavaScript

Using Form Data?

<script type="text/javascript">

function GetTextBoxValue(id) {

alert(document.getElementById(id).value);

}

</script>

<asp:TextBox ID="txt1" runat="server"></asp:TextBox>

<asp:Button ID="btnalert" runat="server" Text="Submit" OnClientClick="javascript:GetTextBoxValue('txt1');" />

Page 12: Javascript

IntroducingIntroducing JavaScriptJavaScript

Confirm Box?

A confirm box is often used if you want the user to verify or accept something

When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed.

If the user clicks "OK", the box returns true. If the user

clicks "Cancel", the box returns false.

Page 13: Javascript

IntroducingIntroducing JavaScriptJavaScript

Prompt Box?

A prompt box is often used if you want the user to input a value before entering a page.

When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.

If the user clicks "OK“, the box returns the input value.

If the user clicks "Cancel“, the box returns null.

Page 14: Javascript

Thank You !Thank You !