Creation of Dynamic rows in javascript

Create a html file with this code and check the functionality:

<script LANGUAGE=”JavaScript”>
function addRow(tableID){
var table = document.getElementById(tableID);

var rowCount = table.rows.length;
var row = table.insertRow(rowCount);

var cell1 = row.insertCell(0);
var element1 = document.createElement(“input”);
element1.type = “text”; = “empNo”;

var cell2 = row.insertCell(1);
var element2 = document.createElement(“input”);
element2.type = “text”;

var cell3 = row.insertCell(2);
var element3 = document.createElement(“textarea”);
function deleteRow(tableID) {

var table = document.getElementById(tableID);
var rowCount = table.rows.length;
if(rowCount > 1) {
table.deleteRow(rowCount – 1);

<form name=”f1″ id=”f1″>
<input type=”button”value=”Add” onclick=”addRow(‘datatable’)”>
<table id=”datatable” cellspacing=”0″ border=”1″ bgcolor=”#738711″>
<td><input type=”text” ></td><td><input type=”text”></td><td><textarea rows=”1″ cols=”10″></textarea></td>

<td><a href=”javascript:void(0);” onclick=”deleteRow(‘datatable’)” >Remove</a></td>

Conversion of string into uppercase

The below function is used to convert the alphabets into uppercase

function convertToUpper(){
var field1 = document.formName.elementName

field1.value = field1.value.toUpperCase();

Example :
If the formName is StudentForm and element name is student id like stud100

Then ,
function convertToUpper(){
var field1 = document.StudentForm.StudentId

field1.value = field1.value.toUpperCase();


gives the value as STUD100.


What is Ajax?
Asynchronous JavaScript and XML.
Ajax is not a new programming language but a new way to use existing standards.

Basic requirements to learn Ajax:
HTML or XHTML and Java Script.

Ajax applications are browser and platform independent.
These applications make the user to communicate asynchronously between browser and server.

With AJAX, a JavaScript can communicate directly with the server, with the XMLHttpRequest object. With this object, a JavaScript can trade data with a web server, without reloading the page.

AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.

The AJAX technique makes Internet applications smaller, faster and more user-friendly.