JavaScript is a scripting language that allows dynamic interactivity on web pages. It was invented by Brendan Eich and can be used to create image galleries, layout changes, and button click responses. JavaScript code can be placed between <script> tags in HTML documents or in external .js files. Some key features include client-side execution in web browsers, dynamic rendering variations across browsers, and potential security issues if not implemented carefully. Common uses of JavaScript include manipulating DOM elements, handling events, and validating forms.
This document provides an overview of JavaScript and jQuery. It covers JavaScript syntax, values, operators, expressions, keywords, comments, objects, functions, conditions, arrays, and the Date object. It also discusses using JavaScript for dynamic web pages, DOM manipulation, and DHTML. Additionally, it provides examples of simple JavaScript programs for adding numbers and using prompt boxes. jQuery is also listed as a topic covered but not described.
This document provides an introduction to JavaScript, including what JavaScript is used for, how it interacts with HTML and CSS, and some basic JavaScript concepts. JavaScript allows making web pages interactive by inserting dynamic text, reacting to events like clicks, performing calculations, and getting information about the user's computer. It is commonly used for calculations, waiting for and responding to events, and manipulating HTML tags. The document discusses JavaScript's role on the client-side, using variables, data types, operators, arrays, functions, and the console for debugging. It provides examples of declaring variables, strings, logical operators, arrays, and functions.
JavaScript is a client-side scripting language that adds interactivity to HTML pages. It can be embedded in HTML using <script> tags and scripts can be placed internally in the HTML file or externally in a .js file. JavaScript code can be inserted in the <head> or <body> sections, but is typically placed at the end of the <body> for faster page loads. Core JavaScript concepts include variables, objects, functions, operators, conditions, loops, and arrays. The DOM (Document Object Model) allows JavaScript to access and modify HTML elements on the page and events can be used to trigger JavaScript functions in response to user actions.
This document provides an overview of key JavaScript concepts including variables, data types, operators, functions, objects, arrays, and booleans. It explains how to declare and assign variables, define functions, create and manipulate objects and arrays, and use comparison operators to evaluate conditions. The document also describes common JavaScript math, string, and array methods for performing operations on variables and values.
JavaScript is a scripting language used primarily for client-side web development. It is based on the ECMAScript standard but browsers support additional objects like Window and DOM objects. JavaScript can be used to create dynamic and interactive effects on web pages like menus, alerts, and updating content without reloading. It is commonly used for form validation, AJAX applications, and other interactive features. The document provides examples of basic JavaScript concepts like variables, data types, operators, and control structures and how to embed scripts in HTML.
This document provides an introduction to JavaScript including:
1. JavaScript is a client-side scripting language that adds interactivity to HTML pages. It is embedded directly into HTML and allows dynamic updating of content.
2. The document covers JavaScript syntax, variables, data types, functions, objects, arrays, strings, dates and more. It provides examples of how to declare variables, write functions, create objects and arrays, and manipulate strings and dates.
3. Methods for output, variable scope, and built-in objects like String, Array, Math and Date are described. The DOM (Document Object Model) and form validation using JavaScript are also mentioned.
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by responding to events and accessing information about the user's computer. It compares JavaScript to other languages like Java and PHP. The document then covers basic JavaScript syntax and constructs including variables, data types, operators, conditional statements, functions, and arrays. It provides examples of how to use many common JavaScript features.
It is a brief about JavaScript, To make understand the development and phases of development JavaScript.
It is helpful for beginner as well as intermediate level.
If you like it please comment or like for more updates.
Thanks
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by manipulating pages or responding to user actions. It covers basic JavaScript syntax including variables, data types, operators, conditional statements, and functions. It also discusses event-driven programming in JavaScript and how to attach JavaScript functions to HTML elements as event handlers.
This document provides an overview of JavaScript including:
1. It discusses JavaScript data types like strings, numbers, booleans, objects and functions.
2. It covers JavaScript operators, control flow, and functions.
3. It describes how to manipulate strings, numbers, dates, arrays and objects in JavaScript.
The document provides an introduction to JavaScript including:
- JavaScript is a lightweight, object-oriented programming language used to add interactivity to webpages. It was introduced in 1995 to enable dynamic content in web browsers.
- Popular features of JavaScript include support across web browsers, a C-like syntax, weak typing, prototype-based inheritance, and client-side scripting abilities.
- Common applications of JavaScript include client-side form validation, dynamic menus, displaying clocks/dates, and pop-up boxes. It allows users to build interactive web applications without page reloads.
This document provides an overview of JavaScript, including its uses, syntax, data types, operators, and objects. JavaScript is an object-based scripting language used to program the behavior of web pages. It allows for client-side validation, dynamic drop-down menus, displaying data and time, and other interactive effects. JavaScript code can be embedded directly in HTML using <script> tags or linked externally. The core data types include numbers, strings, Booleans, arrays, and objects. Objects are similar to arrays but use named indexes instead of numbered indexes. Key JavaScript concepts covered include variables, literals, functions, conditionals, and more.
The document discusses various web frameworks including Node.js, Express.js, and Django. It provides an introduction to each framework, explaining what they are used for and some of their main features. Node.js is introduced as a framework for running JavaScript on the server and some of its core modules are described. Express.js is presented as a web application framework built on Node.js. Django is introduced as a Python web framework that allows for quick development with minimal code.
This document provides an introduction to JavaScript programming for communicators. It covers JavaScript basics like data types, variables, operators, and functions. It also discusses more advanced topics such as objects, arrays, loops, and integrating JavaScript with HTML. The document uses examples in Chrome's developer console to demonstrate JavaScript concepts and syntax.
JavaScript is a client-side scripting language that can be inserted into HTML pages to make them interactive. It allows dynamic validation of forms, changing HTML element properties like visibility, and reacting to user events like clicks or form submissions. The Document Object Model (DOM) represents an HTML or XML document as a tree structure, allowing JavaScript to programmatically access and modify the content, structure, and styling of the document. Common built-in JavaScript objects include String, Date, Array, Math, and Boolean, which provide properties and methods for manipulating text, dates, lists of values, numbers, and true/false values.
Javascript allows for the creation of objects through both the literal syntax and constructor functions. The constructor() method is used to initialize object properties and is called automatically when a new object is created. The this keyword refers to the current object and is used within methods to access properties and methods of the object being constructed.
Front end fundamentals session 1: javascript coreWeb Zhao
This document provides an overview of JavaScript fundamentals presented in a session on JavaScript core concepts. It defines what JavaScript is, demonstrates basic syntax and data types including numbers, strings, Booleans, objects and arrays. It also covers control structures, functions, scope, and built-in objects like Date. The document contains examples and links to interactive demos of JavaScript concepts.
This document provides an introduction to JavaScript and the DOM. It begins with an overview of the author's background and experience. It then covers JavaScript fundamentals like data types, objects, functions, and events. It also discusses the DOM and how to access and manipulate elements using methods like getElementById, querySelector, and properties like childNodes. The document is intended as a basic JavaScript and DOM primer.
- JavaScript is a client-side scripting language used to validate data and embed scripts in HTML documents using the <SCRIPT> tag. It was developed by Brendan Eich and is supported by most browsers.
- Functions, variables, operators, and control structures work similarly in JavaScript as in C++. Common data types include numbers, strings, and Booleans. Functions are defined using the function keyword.
- Built-in functions like alert(), prompt(), and document.write() are used for output. Events like onclick trigger JavaScript execution. Arrays and objects allow storing multiple values.
This document provides an important notice about final project milestones, links to slides about front end web development (FEWD), instructions for setting up a GitHub repository and copying code files for this week's lesson, and an agenda for reviewing variables, conditionals, functions, and working with arrays and collections of data. Students are instructed to begin writing pseudo code and drafting HTML/CSS for their application and submit it by the end of the 7th week.
JavaScript is a versatile programming language used for developing interactive websites. It allows for dynamic content, form validation, and client-side functionality. With frameworks like React and Angular, it enables the creation of complex web applications, making it a crucial tool in modern web development.
JavaScript is a versatile programming language used for developing interactive websites. It allows for dynamic content, form validation, and client-side functionality. With frameworks like React and Angular, it enables the creation of complex web applications, making it a crucial tool in modern web development.
JavaScript is a client-side scripting language that allows dynamic interactions and effects on web pages. It can be inserted directly into HTML code or linked via external .js files. The DOM (Document Object Model) represents an HTML or XML document as a tree structure, with nodes for elements, attributes, and text. This allows JavaScript to access and manipulate the content, structure, and styling of documents. Common JavaScript objects include String, Date, Array, and Math objects for manipulating text, dates, arrays of values, and mathematical operations respectively.
Kevin Corke Spouse Revealed A Deep Dive Into His Private Life.pdfMedicoz Clinic
Kevin Corke, a respected American journalist known for his work with Fox News, has always kept his personal life away from the spotlight. Despite his public presence, details about his spouse remain mostly private. Fans have long speculated about his marital status, but Corke chooses to maintain a clear boundary between his professional and personal life. While he occasionally shares glimpses of his family on social media, he has not publicly disclosed his wife’s identity. This deep dive into his private life reveals a man who values discretion, keeping his loved ones shielded from media attention.
More Related Content
Similar to 1-JAVA SCRIPT. servere-side applications vs client side applications (20)
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by responding to events and accessing information about the user's computer. It compares JavaScript to other languages like Java and PHP. The document then covers basic JavaScript syntax and constructs including variables, data types, operators, conditional statements, functions, and arrays. It provides examples of how to use many common JavaScript features.
It is a brief about JavaScript, To make understand the development and phases of development JavaScript.
It is helpful for beginner as well as intermediate level.
If you like it please comment or like for more updates.
Thanks
This document provides an introduction to JavaScript. It discusses the purposes of JavaScript including making web pages interactive by manipulating pages or responding to user actions. It covers basic JavaScript syntax including variables, data types, operators, conditional statements, and functions. It also discusses event-driven programming in JavaScript and how to attach JavaScript functions to HTML elements as event handlers.
This document provides an overview of JavaScript including:
1. It discusses JavaScript data types like strings, numbers, booleans, objects and functions.
2. It covers JavaScript operators, control flow, and functions.
3. It describes how to manipulate strings, numbers, dates, arrays and objects in JavaScript.
The document provides an introduction to JavaScript including:
- JavaScript is a lightweight, object-oriented programming language used to add interactivity to webpages. It was introduced in 1995 to enable dynamic content in web browsers.
- Popular features of JavaScript include support across web browsers, a C-like syntax, weak typing, prototype-based inheritance, and client-side scripting abilities.
- Common applications of JavaScript include client-side form validation, dynamic menus, displaying clocks/dates, and pop-up boxes. It allows users to build interactive web applications without page reloads.
This document provides an overview of JavaScript, including its uses, syntax, data types, operators, and objects. JavaScript is an object-based scripting language used to program the behavior of web pages. It allows for client-side validation, dynamic drop-down menus, displaying data and time, and other interactive effects. JavaScript code can be embedded directly in HTML using <script> tags or linked externally. The core data types include numbers, strings, Booleans, arrays, and objects. Objects are similar to arrays but use named indexes instead of numbered indexes. Key JavaScript concepts covered include variables, literals, functions, conditionals, and more.
The document discusses various web frameworks including Node.js, Express.js, and Django. It provides an introduction to each framework, explaining what they are used for and some of their main features. Node.js is introduced as a framework for running JavaScript on the server and some of its core modules are described. Express.js is presented as a web application framework built on Node.js. Django is introduced as a Python web framework that allows for quick development with minimal code.
This document provides an introduction to JavaScript programming for communicators. It covers JavaScript basics like data types, variables, operators, and functions. It also discusses more advanced topics such as objects, arrays, loops, and integrating JavaScript with HTML. The document uses examples in Chrome's developer console to demonstrate JavaScript concepts and syntax.
JavaScript is a client-side scripting language that can be inserted into HTML pages to make them interactive. It allows dynamic validation of forms, changing HTML element properties like visibility, and reacting to user events like clicks or form submissions. The Document Object Model (DOM) represents an HTML or XML document as a tree structure, allowing JavaScript to programmatically access and modify the content, structure, and styling of the document. Common built-in JavaScript objects include String, Date, Array, Math, and Boolean, which provide properties and methods for manipulating text, dates, lists of values, numbers, and true/false values.
Javascript allows for the creation of objects through both the literal syntax and constructor functions. The constructor() method is used to initialize object properties and is called automatically when a new object is created. The this keyword refers to the current object and is used within methods to access properties and methods of the object being constructed.
Front end fundamentals session 1: javascript coreWeb Zhao
This document provides an overview of JavaScript fundamentals presented in a session on JavaScript core concepts. It defines what JavaScript is, demonstrates basic syntax and data types including numbers, strings, Booleans, objects and arrays. It also covers control structures, functions, scope, and built-in objects like Date. The document contains examples and links to interactive demos of JavaScript concepts.
This document provides an introduction to JavaScript and the DOM. It begins with an overview of the author's background and experience. It then covers JavaScript fundamentals like data types, objects, functions, and events. It also discusses the DOM and how to access and manipulate elements using methods like getElementById, querySelector, and properties like childNodes. The document is intended as a basic JavaScript and DOM primer.
- JavaScript is a client-side scripting language used to validate data and embed scripts in HTML documents using the <SCRIPT> tag. It was developed by Brendan Eich and is supported by most browsers.
- Functions, variables, operators, and control structures work similarly in JavaScript as in C++. Common data types include numbers, strings, and Booleans. Functions are defined using the function keyword.
- Built-in functions like alert(), prompt(), and document.write() are used for output. Events like onclick trigger JavaScript execution. Arrays and objects allow storing multiple values.
This document provides an important notice about final project milestones, links to slides about front end web development (FEWD), instructions for setting up a GitHub repository and copying code files for this week's lesson, and an agenda for reviewing variables, conditionals, functions, and working with arrays and collections of data. Students are instructed to begin writing pseudo code and drafting HTML/CSS for their application and submit it by the end of the 7th week.
JavaScript is a versatile programming language used for developing interactive websites. It allows for dynamic content, form validation, and client-side functionality. With frameworks like React and Angular, it enables the creation of complex web applications, making it a crucial tool in modern web development.
JavaScript is a versatile programming language used for developing interactive websites. It allows for dynamic content, form validation, and client-side functionality. With frameworks like React and Angular, it enables the creation of complex web applications, making it a crucial tool in modern web development.
JavaScript is a client-side scripting language that allows dynamic interactions and effects on web pages. It can be inserted directly into HTML code or linked via external .js files. The DOM (Document Object Model) represents an HTML or XML document as a tree structure, with nodes for elements, attributes, and text. This allows JavaScript to access and manipulate the content, structure, and styling of documents. Common JavaScript objects include String, Date, Array, and Math objects for manipulating text, dates, arrays of values, and mathematical operations respectively.
Kevin Corke Spouse Revealed A Deep Dive Into His Private Life.pdfMedicoz Clinic
Kevin Corke, a respected American journalist known for his work with Fox News, has always kept his personal life away from the spotlight. Despite his public presence, details about his spouse remain mostly private. Fans have long speculated about his marital status, but Corke chooses to maintain a clear boundary between his professional and personal life. While he occasionally shares glimpses of his family on social media, he has not publicly disclosed his wife’s identity. This deep dive into his private life reveals a man who values discretion, keeping his loved ones shielded from media attention.
Module4: Ventilation
Definition, necessity of ventilation, functional requirements, various system & selection criteria.
Air conditioning: Purpose, classification, principles, various systems
Thermal Insulation: General concept, Principles, Materials, Methods, Computation of Heat loss & heat gain in Buildings
This presentation provides a comprehensive overview of air filter testing equipment and solutions based on ISO 5011, the globally recognized standard for performance testing of air cleaning devices used in internal combustion engines and compressors.
Key content includes:
Expansive soils (ES) have a long history of being difficult to work with in geotechnical engineering. Numerous studies have examined how bagasse ash (BA) and lime affect the unconfined compressive strength (UCS) of ES. Due to the complexities of this composite material, determining the UCS of stabilized ES using traditional methods such as empirical approaches and experimental methods is challenging. The use of artificial neural networks (ANN) for forecasting the UCS of stabilized soil has, however, been the subject of a few studies. This paper presents the results of using rigorous modelling techniques like ANN and multi-variable regression model (MVR) to examine the UCS of BA and a blend of BA-lime (BA + lime) stabilized ES. Laboratory tests were conducted for all dosages of BA and BA-lime admixed ES. 79 samples of data were gathered with various combinations of the experimental variables prepared and used in the construction of ANN and MVR models. The input variables for two models are seven parameters: BA percentage, lime percentage, liquid limit (LL), plastic limit (PL), shrinkage limit (SL), maximum dry density (MDD), and optimum moisture content (OMC), with the output variable being 28-day UCS. The ANN model prediction performance was compared to that of the MVR model. The models were evaluated and contrasted on the training dataset (70% data) and the testing dataset (30% residual data) using the coefficient of determination (R2), Mean Absolute Error (MAE), and Root Mean Square Error (RMSE) criteria. The findings indicate that the ANN model can predict the UCS of stabilized ES with high accuracy. The relevance of various input factors was estimated via sensitivity analysis utilizing various methodologies. For both the training and testing data sets, the proposed model has an elevated R2 of 0.9999. It has a minimal MAE and RMSE value of 0.0042 and 0.0217 for training data and 0.0038 and 0.0104 for testing data. As a result, the generated model excels the MVR model in terms of UCS prediction.
Video Games and Artificial-Realities.pptxHadiBadri1
🕹️ #GameDevs, #AIteams, #DesignStudios — I’d love for you to check it out.
This is where play meets precision. Let’s break the fourth wall of slides, together.
This presentation provides a comprehensive overview of a specialized test rig designed in accordance with ISO 4548-7, the international standard for evaluating the vibration fatigue resistance of full-flow lubricating oil filters used in internal combustion engines.
Key features include:
Department of Environment (DOE) Mix Design with Fly Ash.MdManikurRahman
Concrete Mix Design with Fly Ash by DOE Method. The Department of Environmental (DOE) approach to fly ash-based concrete mix design is covered in this study.
The Department of Environment (DOE) method of mix design is a British method originally developed in the UK in the 1970s. It is widely used for concrete mix design, including mixes that incorporate supplementary cementitious materials (SCMs) such as fly ash.
When using fly ash in concrete, the DOE method can be adapted to account for its properties and effects on workability, strength, and durability. Here's a step-by-step overview of how the DOE method is applied with fly ash.
2. SERVER-SIDE APPLICATIONS VS. CLIENT-SIDE APPLICATIONS
• server-side applications are applications runs on the Web Server
• Client-side applications are small applications which are embedded within the HTML
code and executed by the browser.
Server-Side Code
• Languages include Python , PHP, C#, Servlets and JSP;
• Cannot be seen by the user .
• Can only respond to HTTP requests
Client-Side Code
• Languages used include: HTML, CSS, and Java script.
• Parsed by the user’s browser.
• Reacts to user input.
3. WHAT IS DHTML?
• Dynamic HyperText Markup Language
(DHTML) is a combination of Web
development technologies used to create
dynamically changing websites.
DHTML = HTML + CSS +JavaScript
4. WHAT IS JAVASCRIPT
• JavaScript is a scripting language designed primarily
for creating dynamic Web pages.
• It is used to add dynamic behavior, store information,
and handle requests and responses on a website
• JavaScript is most commonly used as a client side
scripting language. This means that JavaScript code is
written into an HTML page.
5. HISTORY OF JAVASCRIPT ?
• JavaScript was created by Brendan Eich in
1995 at Netscape Communications.
• JavaScript was first known as LiveScript, but
Netscape changed its name to JavaScript
• JavaScript made its first appearance in
Netscape 2.0 in 1995 with the
name LiveScript.
6. JAVASCRIPT- SYNTAX
• JavaScript can be implemented using JavaScript statements that are placed within
the <script>... </script>
• You can place the <script> within the <head> tags.
• The script tag takes two important attributes :
• Language − This attribute specifies what scripting language you are using.
Typically, its value will be javascript.
• Type − The type attribute specifies the content in the script tag
8. VARIABLES IN JAVA SCRIPT
• Variables are used to hold data.
• JavaScript is a case-sensitive language
Syntax:
var varname;
<body>
<script>
var x = 5;
var y = 6;
var z = x + y;
document.write("value of z is" +z);
</script>
</body> </html>
10. FUNCTIONS
• A function is some code that is executed when an event fires
or a call to that function is made.
• Typically a function contains several lines of code.
• Functions are written in the <head> element.
Syntax
function function-name(parameter1, parameter2, parameter3)
{
code to be executed
}
13. BUILT-IN OBJECTS IN JAVASCRIPT
• JavaScript supports a number of built-in objects that extend the flexibility of
the language.
• Javascript provides following built-in objects
1.Date
2.Math
3.Array
4.String
14. DATE OBJECT
• The JavaScript date object can be used to get
year, month and day.
• Date objects are created with the new Date( )
Syntax
• var obj=new Date();
15. Method Description
getFullYear() returns the year in 4 digit e.g. 2015.
getMonth() returns the month in 2 digit from 0 to 11. So it
is better to use getMonth()+1 in your code.
getDate() returns the date in 1 or 2 digit from 1 to 31.
getDay() returns the day of week in 1 digit from 0 to 6.
getHours() returns the hour (0-23)
getMinutes() Returns the minutes (0-59)
getSeconds() returns the seconds (0-59)
getMilliseconds() returns the milliseconds.
Date Methods
Method Description
getFullYear() returns the year in 4 digit e.g. 2015.
getMonth() returns the month in 2 digit from 0 to 11. So it
is better to use getMonth()+1 in your code.
getDate() returns the date in 1 or 2 digit from 1 to 31.
getDay() returns the day of week in 1 digit from 0 to 6.
getHours() returns the hour (0-23)
getMinutes() Returns the minutes (0-59)
getSeconds() returns the seconds (0-59)
getMilliseconds() returns the milliseconds.
18. •The JavaScript math object provides
several methods to perform mathematical
operation.
• Unlike date object, it doesn't have
constructors.
Math Object
19. Method Description
abs() Returns the absolute value of a number.
ceil() Returns the integer greater than or equal to a number.
floor() Returns the integer less than or equal to a number.
pow() Returns base to the exponent power, that is, base exponent.
random() Returns a random number between 0 and 1.
round() Returns the value of a number rounded to the nearest
integer.
sqrt() Returns the square root of a number.
Math Object Methods
20. Example
<script>
document.write(Math.sqrt(4));
document.write("<br> Randam no is:" +Math.random());
document.write("<br> power is:"+ Math.pow(2,4));
document.write("<br> floor is:" +Math.floor(4.6));
document.write("<br> ceil is:"+Math.ceil(4.6));
document.write("<br> Round of no is:"+Math.round(4.6))
document.write("<br> absolute no is"+Math.abs(-4))
</script>
22. Array object
•JavaScript array is an object that
represents a collection of similar type of
elements.
•There are 3 ways to construct array in
JavaScript
1.By array literal
2.By creating instance of Array directly
(using new keyword)
3.By using an Array constructor (using
new keyword)
23. 1) JavaScript array literal
•The syntax of creating array using array literal :
var arrayname=[value1,value2.....valueN];
Ex:
var emp=["Sonoo","Vimal","Ratan"];
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br/>");
}
24. 2) JavaScript Array directly (new keyword)
•The syntax of creating array directly is given below:
var arrayname=new Array();
•Here, new keyword is used to create instance of array.
Example:
<script>
var i;
var emp = new Array();
emp[0] = "Arun";
emp[1] = "Varun";
emp[2] = "John";
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br>");
}
</script>
25. 3) JavaScript array constructor (new keyword)
•Here, you need to create instance of array by passing arguments in
constructor so that we don't have to provide value explicitly.
Example:
<script>
var emp=new Array("Jai","Vijay","Smith");
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br>");
}
</script>
26. •Javascript array length property
returns the number of elements in
an array.
Syntax:
array.length
27. Methods
Method Description
concat() Returns a new array comprised of this array joined with other array(s)
and/or value(s).
pop() Removes the last element from an array and returns that element.
push() Adds one or more elements to the end of an array and returns the new
length of the array.
reverse() Reverses the order of the elements of an array -- the first becomes the
last, and the last becomes the first.
shift() Removes the first element from an array and returns that element.
slice() Extracts a section of an array and returns a new array.
sort() Sorts the elements of an array
unshift() Adds one or more elements to the front of an array and returns the new
length of the array.
28. <script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write("<h1> Before Array operations:</h1>"+fruits);
fruits.pop();
document.write("<h1> After POP():</h1>"+fruits);
fruits.push("Kiwi");
document.write("<h1> After Push():</h1>"+fruits);
fruits.shift();
document.write("<h1> After shift():</h1>"+fruits);
fruits.unshift("Sapota");
document.write("<h1> After unshift():</h1>"+fruits);
var num=["2","1","3"]
var my= num.concat(fruits);
document.write("<h1> After concat():</h1>"+my);
document.write("<h1> After reverse:</h1>"+my.reverse());
document.write("<h1> After sort:</h1>"+my.sort());
</script>
30. String Object
•The JavaScript string is an object that represents a
sequence of characters.
•There are 2 ways to create string in JavaScript
•By string literal
•By string object (using new keyword)
1.string literal
The string literal is created using double quotes.
syntax:
var stringname="string value";
Ex:
<script>
var str="This is string literal";
document.write(str);
</script>
31. 2)string object (using new keyword)
var stringname=new String("string literal");
•Here, new keyword is used to create
instance of string.
Ex:
<script>
var str=new String("hello javascript string");
document.write(stringname);
</script>
32. Methods
Method Description
charAt() Returns the character at the specified index.
concat() Combines the text of two strings and returns a new string.
replace() Used to find a match between a regular expression and a
string, and to replace the matched substring with a new
substring.
slice() Extracts a section of a string and returns a new string.
substr() Returns the characters in a string beginning at the specified
location through the specified number of characters.
toLowerCase() Returns the calling string value converted to lower case.
toString() Returns a string representing the specified object.
toUpperCase() Returns the calling string value converted to uppercase.
35. Window Object
The window object represents a window in browser.
An object of window is created automatically by the
browser.
Method Description
alert() displays the alert box containing message
with ok button.
confirm() displays the confirm dialog box containing
message with ok and cancel button.
prompt() displays a dialog box to get input from the
user.
36. Alert dialog box
•It displays alert dialog box. It has message and ok button.
<html><head>
<script>
function msg(){
alert("Hello Alert Box");
}
</script></head> <body>
<input type="button" value="click" onclick="msg()">
</body></html>
38. confirm() dialog box
•It displays the confirm dialog box. It has message with ok and cancel
buttons.
<html><head><script>
function msg(){
var v= confirm("Are u sure?");
if(v==true){
alert("ok");
}
else{
alert("cancel");
}
} </script> </head> <body>
<input type="button" value="deletrecord" onclick="msg()">
</body></html>
40. prompt dialog Box
•It displays prompt dialog box for input. It has message and textfield.
<html><head><script>
function msg(){
var v= prompt("Who are you?");
alert("I am "+v);
}
</script> </head> <body>
<input type="button" value="click" onclick="msg()">
</body></html>
42. DOCUMENT OBJECT
• A Document object represents the
HTML document that is displayed in that
window.
• Document object Each HTML document that
−
gets loaded into a window becomes a document
object
44. Methods of document object
Method Description
write("string") writes the given string on the document.
writeln("string") writes the given string on the document
with newline character at the end.
getElementById() returns the element having the given id
value.
45. Accessing field value by document object
•document.form1.name.value is used to get the
value of name field.
•Here, document is the root element that
represents the html document.
•form1 is the name of the form.
•name is the attribute name of the input text.
•value is the property, that returns the value of the
input text.
48. HTML Events
•JavaScript's interaction with HTML is handled
through events.
•An HTML event can be something the browser
does, or something a user does.
•A JavaScript can be executed when an event
occurs, like when a user clicks on an HTML
element.
Event Description
onclick The user clicks an HTML element
onsubmit occurs when form is submitted.
49. onclick Event Type
•This is the most frequently used event type which occurs when a
user clicks the html element like button.
Syntax:
onclick= function()
Ex:
<input type="button" onclick="printvalue()" value="print name"/>
50. onsubmit Event type
•onsubmit is an event that occurs when you try to submit a form. You can
put your form validation against this event type.
Ex:
<form name="myform" method="post" onsubmit="validateform()" >
51. DATA VALIDATION
Data validation is the process of ensuring that user input is clean, correct, and useful.
• Typical validation tasks are:
1. has the user filled in all required fields?
2. has the user entered a valid date?
3. has the user entered text in a numeric field?
• Most often, the purpose of data validation is to ensure correct user input.
• Validation can be defined by many different methods, and deployed in many
different ways.
Server side validation is performed by a web server, after input has been sent to
the server.
Client side validation is performed by a web browser, before input is sent to a web
server.
52. JavaScript Form Validation
Java script is a client side validation
What is form validation?
Form validation is the process of
making sure that data supplied by the
user using a form, meets the criteria set
for collecting data from the user
54. <html><head>
<script type="text/javascript">
function validation()
{
var a = document.form.name.value;
if(a=="")
{
alert("Please Enter Your Name");
return false;
}
if(!isNaN(a))
{
alert("Please Enter Only Characters");
return false;
}
if ((a.length < 5) || (a.length > 15))
{
alert("Your Character must be 5 to 15
Character");
return false;}}
</script></head>
<body>
<form name="form" method="post"
onsubmit="return validation()">
Your Name:<input type="text"
name="name"">
<input type="submit" name="sub"
value="Submit">
</form></body></html>
55. Password Validation
Rules:
6 to 20 characters which contain at
least one numeric digit, one
uppercase and one lowercase letter
56. <html> <head><script>
function CheckPassword()
{
input=document.form1.text1.value;
var pass= /^(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/;
if(input.match(pass))
{
alert("Correct")
return true;
}
else
{
alert('Wrong...!')
return false;
} }
</script> </head>
<body>
<h2>Input Password and Submit [6 to 20
characters which contain at least one
numeric digit, one uppercase and one
lowercase letter]</h2>
<form name="form1" action="#">
Enter Password <input type="text"
name="text1"/>
<input type="submit" name="submit"
value="Submit"
onclick="CheckPassword()"/>
</form> </body> </html>
57. Email Validation
1.Must have @ and . characters
2.Word before and after @ then .
After word with 2 to 3 characters.