Wednesday, August 13, 2008

Javascript Tutorial : The FIrst Step - Hello World script

So you are excited about writing your first script in Javascript. Hereafter Javascript would be cumbersome to write so the popular acronym js i sbeing used.
So, what do you need to write a js script?
Just a browser with the js engine, Thats it!!! really. most of todays browsers like IE, Firefox, Opera happen to have it. You can actually type in js code in the address bar of the browser and it executes fine. To write code that you shall need later better save it somewhere. To write code in an organised manner though a text editor would be much more helpful. The text editors you can use better be WYSIWYG editors or What You See Is What You Get editors. People working on Windows could well use Notepad if they dont have any other editor to start with.

The hello world script
The first script that we write shall open an alert box in the browser. That should be enough to get you started :).
Now in the text editor write the following code in italics

Monday, August 11, 2008

Introduction to javascript

Javascript is the most popular language to add behaviour to web pages. Javascript adds dynamism to web pages which has become so popular these days. Add AJAX to the recipe and we have a solid foundation to add behavior. As we begin to explore this exciting scripting language let me tell you what it means to be a scripting language.
Javascript is an interpreted language:
People from a technical background might easily understand this; but for newbies it might not be apparent. Classical programming languages like C,C++,COBOL are compiled by the compiler first and on compilation we get the compiled object file. So each time we run the program the code is not executed each time, rather the object file is referenced. On the other hand an interpreted language is read line by line each time the program is executed.

Javascript is a programming language:
Contrary to popular perception, Javascript is not just a scripting language. Its a lot more than that. It has all the qualities that a programming language should have. In addition to most of the program constructs available in language like C, it also has strong Object Oriented Concepts making it a powerful language indeed.

Javascript != Java :
People always wonder whether javascript and java have anything in common. The truth is Javascript was names LiveScript initially by Netscape. But with the success of Java it was called JavaScript.