Skip to playerSkip to main contentSkip to footer
  • 11/16/2014
In this video we will discuss
1. The use of JavaScript in a web application.
2. Advantages of using JavaScript

What are the advantages of using JavaScript
1. Form validation can be done on the client side, which reduces the unnecessary round trips between the client and the server. This also means the load on the server is reduced and the application is more responsive.
2. JavaScript uses the client machine processing power.
3. With JavaScript partial page updates are possible i.e only portions of the page can be updated, without reloading the entire web form. This is commonly called as AJAX.
4. JavaScript can also be used to animate elements on a page. For example, show or hide elements and sections of the page.

function ValidateForm() {
var ret = true;
if (document.getElementById("txtFirstName").value == "")
{
document.getElementById("lblFirstName").innerText = "First Name is required";
ret = false;
}
else
{
document.getElementById("lblFirstName").innerText = "";
}

if (document.getElementById("txtLastName").value == "") {
document.getElementById("lblLastName").innerText = "Last Name is required";
ret = false;
}
else {
document.getElementById("lblLastName").innerText = "";
}

if (document.getElementById("txtEmail").value == "") {
document.getElementById("lblEmail").innerText = "Email is required";
ret = false;
}
else {
document.getElementById("lblEmail").innerText = "";
}

return ret;
}

Recommended