SlideShare a Scribd company logo
Introducing JavaScript by Rama Krishnam Raju
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 .
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
Introducing   JavaScript 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
Introducing   JavaScript 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 &quot;snippets&quot; of code into their HTML pages . JavaScript can put dynamic text into an HTML page  - A JavaScript statement like this: document. write(&quot;<h1>&quot; + name + &quot;</h1>&quot;) 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
Introducing JavaScript Arithmetic Operators Arithmetic operators are used to perform arithmetic between variables and/or values. The  following table  explains the arithmetic operators
Introducing JavaScript Assignment Operators Assignment operators are used to assign values to JavaScript variables. The  following table  explains the assignment operators
Introducing JavaScript Comparison Operators Comparison operators are used to compare values to JavaScript variables. The  following table  explains the Comparison operators
Introducing JavaScript Logical Operators Logical operators are used to compare logical values to JavaScript variables. The  following table  explains the Logical operators
Introducing   JavaScript How to Put a JavaScript Into an HTML Page?   <html> <body> <script type=&quot;text/javascript&quot;> document.write(&quot;Hello World!&quot;) </script> </body> </html>
Introducing   JavaScript Using Form Data ? <script type=&quot;text/javascript&quot;> function GetTextBoxValue(id) { alert(document.getElementById(id).value); } </script> <asp:TextBox ID=&quot;txt1&quot; runat=&quot;server&quot;></asp:TextBox> <asp:Button ID=&quot;btnalert&quot; runat=&quot;server&quot; Text=&quot;Submit&quot; OnClientClick=&quot;javascript:GetTextBoxValue('txt1');&quot; />
Introducing   JavaScript   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 &quot;OK&quot; or &quot;Cancel&quot; to proceed. If the user clicks &quot;OK&quot;, the box returns true. If the user clicks &quot;Cancel&quot;, the box returns false.
Introducing   JavaScript   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 &quot;OK&quot; or &quot;Cancel&quot; to proceed after entering an input value. If the user clicks &quot;OK“, the box returns the input value. If the user clicks &quot;Cancel“, the box returns null.
Thank You !

More Related Content

Javascript

  • 1. Introducing JavaScript by Rama Krishnam Raju
  • 2. 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 .
  • 3. 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
  • 4. Introducing JavaScript 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
  • 5. Introducing JavaScript 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 &quot;snippets&quot; of code into their HTML pages . JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document. write(&quot;<h1>&quot; + name + &quot;</h1>&quot;) 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
  • 6. Introducing JavaScript Arithmetic Operators Arithmetic operators are used to perform arithmetic between variables and/or values. The following table explains the arithmetic operators
  • 7. Introducing JavaScript Assignment Operators Assignment operators are used to assign values to JavaScript variables. The following table explains the assignment operators
  • 8. Introducing JavaScript Comparison Operators Comparison operators are used to compare values to JavaScript variables. The following table explains the Comparison operators
  • 9. Introducing JavaScript Logical Operators Logical operators are used to compare logical values to JavaScript variables. The following table explains the Logical operators
  • 10. Introducing JavaScript How to Put a JavaScript Into an HTML Page? <html> <body> <script type=&quot;text/javascript&quot;> document.write(&quot;Hello World!&quot;) </script> </body> </html>
  • 11. Introducing JavaScript Using Form Data ? <script type=&quot;text/javascript&quot;> function GetTextBoxValue(id) { alert(document.getElementById(id).value); } </script> <asp:TextBox ID=&quot;txt1&quot; runat=&quot;server&quot;></asp:TextBox> <asp:Button ID=&quot;btnalert&quot; runat=&quot;server&quot; Text=&quot;Submit&quot; OnClientClick=&quot;javascript:GetTextBoxValue('txt1');&quot; />
  • 12. Introducing JavaScript 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 &quot;OK&quot; or &quot;Cancel&quot; to proceed. If the user clicks &quot;OK&quot;, the box returns true. If the user clicks &quot;Cancel&quot;, the box returns false.
  • 13. Introducing JavaScript 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 &quot;OK&quot; or &quot;Cancel&quot; to proceed after entering an input value. If the user clicks &quot;OK“, the box returns the input value. If the user clicks &quot;Cancel“, the box returns null.