IAC 2024 - IA Fast Track to Search Focused AI Solutions
Introduction of javascript
1. INTRODUCTION OF JAVASCRIPT
What is JavaScript?
JavaScript (sometimes abbreviated JS) is a prototype-based scripting language that
is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language,
supporting object-oriented, imperative, and functional programming styles. JavaScript is
an implementation of the ECMAScript language standard and is typically used to enable
programmatic access to computational objects within a host environment. JavaScript is a
programming language used to make web pages interactive. It runs on your visitor's
computer and doesn't require constant downloads from your website. JavaScript is often
used to create polls and quizzes. It is the standard language used in web pages, but it is
also widely used by desktop apps, mobile phone apps, and internet servers.
Why we use JavaScript?
JavaScript is not specifically HTML related, but interacts with HTML and DHTML when
used in a browser. It's a more traditional programming language, in that you can write a
series of instructions to compute what kinds of actions should be taken based on various
conditions, repeat things a variable number of times, and just generally take more complex
and sophisticated actions. Small applications and games have been written entirely in
JavaScript.
The line between DHTML and JavaScript can sometimes get blurry, but a rule of thumb I
use is simple: DHTML is about the web page, period. The items on a web page, the events
that a web page might want to act on (like moving your mouse over text), and the resulting
changes to the web page that you might want to have happen resulting from those events
(like changing the color of text). JavaScript, however, is really web, and HTML,
independent. It adds programming things like loops, and variables and functions. You could
write a small program to calculate Pi in JavaScript, and then perhaps use DHTML to do
something interesting on the web page with it.
2. What is the purpose of JavaScript?
Functions allow us to remove these statements from all of the places that they are needed
and define them just once. We then “call” the function from each of the places where we
need those statements to run. This makes maintaining the code easier as we only have one
place where the particular series of statements occurs rather than repetitions of the
same code. Any changes to that one block will automatically apply to each place where the
function is called.Using functions also allows us to modularize our approach to writing the
code. This means that we can break up the processing into sections and not concern
ourselves with how all of the processing needs to work all at the same time. When we are
coding the function we need only concern ourselves with how the function needs to be
coded in order to perform its intended task.
JavaScript program:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>zoya</title>
<script type="text/javascript">
functionabc()
{
var a=document.getElementById('un').value;
if(a=="")
{
alert("Must be enter name");
3. return false;
}
var p=document.getElementById('pwd').value;
if(p=="")
{
alert("must enter pasword");
return false;
}
if(p.length<8)
{
alert("password too Short");
return false;
}
if(p.length>=14)
{
alert("password too long");
return false;
}
var e=document.getElementById('em').value;
em.indexof("@")
if(e==-1)
{
alert("must enter @");