22 November, 2010

a Javascript a day | my javascript tutorial . . .


                 Here i share my basic experimentsi had done with javascript. Its not enough for making a geekness with that, but only for making the first lessons of javascript ...

What is javascript ?

JavaScript is a scripting language that will allow you to add real programming to your webpages. You can create small application type processes with JavaScript, like a calculator or a primitive game of some sort. Important uses of javascript are
  • Browser Detection
    • Detecting the browser used by a visitor at your page. Depending on the browser, another page specifically designed for that browser can then be loaded. 
  • Cookies
    • Storing information on the visitor's computer, then retrieving this information automatically next time the user visits your page. This technique is called "cookies".
  • Control Browsers
    • Opening pages in customized windows, where you specify if the browser's buttons, menu line, status line or whatever should be present.
  • Validate Forms
    • Validating inputs to fields before submitting a form. An example would be validating the entered email address to see if it has an @ in it, since if not, it's not a valid address. 
 
where is the playground ?

The browser will use the 
<script type="text/javascript"> and </script> to tell where javascript starts and ends respectively.

The <script> …… </script>  Tag can be included in

  • <head> section
  • <body> section
  •  Both <head> section and <body> section
  •  In an External file with .js extension    
    • Eg : <script type="text/javascript" src="xxx.js"></script> 
To declare a variable in JavaScript, use the var command.    Eg : var state, city, zip, country; 

Basics

  • Write directly into the document.
     >> document.write("Welcome to my world!!!");

  • Write using POPUP Boxes
     Alert Box
     >> alert("Welcome to my world!!!");

     Confirm Box

     >>if (confirm("Do you agree")) 

               {alert("You agree")}
           else{alert ("You do not agree")};

    Prompt Box
    >> username=prompt("Please enter your 

                    name","Enter your name here");  

Check out this link to make out the rest.

1 comments:

Bloglarim on Sunday, May 29, 2011 said...

[ Placing Code ]
[ Functions ]
[ Events ]
[ Comments ]
[ Conditionals-looping ]
[ Hiding the JavaScript ]
[ Date object ]
[ Prompt Method ]
[ Alert Method ]
[ Confirm Method ]
[ write and writeln ]
[ Operators ]
[ Variable ]
[ When JS Statements Run ]
[ Objects ]
[ Examples ]
[ Glossary Terms ]

Post a Comment

speak out... itz your time !!!

 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger