Javascript Basics-1 Javascript is a scripting language which runs inside a web browser. It was developed by Netscape Navigator. Javascript is an Object Oriented Language with automatic type conversion and doesn’t require variable declaration before use. To run Javascript you need create a html page and add the Javascript within To start with, just write alert(“Hello”); inside a Javascript script tag and load the page. Here is the complete code. Alert Javascript has the following data types. Javascript provides event handlers for reacting to different events like click, mouse move, key press,etc Javascript also provides methods for accessing elements in the html document via the methods of the document object. document.getElementbyId(id) returns a single object. Returns null if the element doesn’t exist. document.getElementsByName(name) returns an array of elements. It returns an array of 0 length if the name does not exist. document.getElementsByTagName(tagname) returns an array of elements of the given tag. For example document.getElementsByTagName(“p”) would return an array of paragraphs. Lastly, we have a document.getElementsByClassName that searches on the basis of css classes Examples This will swap contents of the 2 textboxes. Id A
B
Elements By Name This will uncheck each and every Radio Button. Name A
B
C
D
E
F
GetElementsByClassName Search elements by css classname Class Name A
B
C
D
E
F
  GetElementsByTagName search elements by tag name Tag Name A

B


C

D


E

F