web programming concepts is Overview of Java Script
A number of Technologies are present that develops the static web page, but we require a language that is dynamic in nature to develop web pages.
JavaScript was created by Brendan Eich in 1995 at Netscape Communications.
JavaScript was the first client-side scripting language developed by Netscape.
JavaScript made its first appearance in Netscape 2.0 in 1995 with the name LiveScript.
Overview of Java Script
A number of Technologies are present that develops the static web page, but we require a language that is dynamic in nature to develop web pages.
JavaScript was created by Brendan Eich in 1995 at Netscape Communications.
JavaScript was the first client-side scripting language developed by Netscape.
JavaScript made its first appearance in Netscape 2.0 in 1995 with the name LiveScript.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pages.
Javascript is an interpreted language usually used with HTML, and programs written in JavaScript are called lightweight scripts.
JavaScript is a simple language which is only suitable for simple tasks.
JavaScript is an object-based client-side scripting language that is popular and used to create dynamic and interactive web pa
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
JavaScript is a versatile programming language primarily used for building dynamic and interactive web applications. Developed by Netscape Communications Corporation in the mid-1990s, JavaScript has since become one of the most popular programming languages worldwide. Here's a detailed description of JavaScript:
Introduction to JavaScript:
JavaScript is a high-level, interpreted programming language that allows developers to add functionality, interactivity, and behavior to web pages. Unlike server-side languages like PHP or Python, JavaScript is executed on the client-side, meaning it runs within the user's web browser. This enables dynamic manipulation of webpage content without requiring communication with the server.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
JavaScript is a versatile programming language primarily used for building dynamic and interactive web applications. Developed by Netscape Communications Corporation in the mid-1990s, JavaScript has since become one of the most popular programming languages worldwide. Here's a detailed description of JavaScript:
Introduction to JavaScript:
JavaScript is a high-level, interpreted programming language that allows developers to add functionality, interactivity, and behavior to web pages. Unlike server-side languages like PHP or Python, JavaScript is executed on the client-side, meaning it runs within the user's web browser. This enables dynamic manipulation of webpage content without requiring communication with the server.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Online aptitude test management system project report.pdfKamal Acharya
The purpose of on-line aptitude test system is to take online test in an efficient manner and no time wasting for checking the paper. The main objective of on-line aptitude test system is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc. This can be used in educational institutions as well as in corporate world. Can be used anywhere any time as it is a web based application (user Location doesn’t matter). No restriction that examiner has to be present when the candidate takes the test.
Every time when lecturers/professors need to conduct examinations they have to sit down think about the questions and then create a whole new set of questions for each and every exam. In some cases the professor may want to give an open book online exam that is the student can take the exam any time anywhere, but the student might have to answer the questions in a limited time period. The professor may want to change the sequence of questions for every student. The problem that a student has is whenever a date for the exam is declared the student has to take it and there is no way he can take it at some other time. This project will create an interface for the examiner to create and store questions in a repository. It will also create an interface for the student to take examinations at his convenience and the questions and/or exams may be timed. Thereby creating an application which can be used by examiners and examinee’s simultaneously.
Examination System is very useful for Teachers/Professors. As in the teaching profession, you are responsible for writing question papers. In the conventional method, you write the question paper on paper, keep question papers separate from answers and all this information you have to keep in a locker to avoid unauthorized access. Using the Examination System you can create a question paper and everything will be written to a single exam file in encrypted format. You can set the General and Administrator password to avoid unauthorized access to your question paper. Every time you start the examination, the program shuffles all the questions and selects them randomly from the database, which reduces the chances of memorizing the questions.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...ssuser7dcef0
Power plants release a large amount of water vapor into the
atmosphere through the stack. The flue gas can be a potential
source for obtaining much needed cooling water for a power
plant. If a power plant could recover and reuse a portion of this
moisture, it could reduce its total cooling water intake
requirement. One of the most practical way to recover water
from flue gas is to use a condensing heat exchanger. The power
plant could also recover latent heat due to condensation as well
as sensible heat due to lowering the flue gas exit temperature.
Additionally, harmful acids released from the stack can be
reduced in a condensing heat exchanger by acid condensation. reduced in a condensing heat exchanger by acid condensation.
Condensation of vapors in flue gas is a complicated
phenomenon since heat and mass transfer of water vapor and
various acids simultaneously occur in the presence of noncondensable
gases such as nitrogen and oxygen. Design of a
condenser depends on the knowledge and understanding of the
heat and mass transfer processes. A computer program for
numerical simulations of water (H2O) and sulfuric acid (H2SO4)
condensation in a flue gas condensing heat exchanger was
developed using MATLAB. Governing equations based on
mass and energy balances for the system were derived to
predict variables such as flue gas exit temperature, cooling
water outlet temperature, mole fraction and condensation rates
of water and sulfuric acid vapors. The equations were solved
using an iterative solution technique with calculations of heat
and mass transfer coefficients and physical properties.
ACEP Magazine edition 4th launched on 05.06.2024Rahul
This document provides information about the third edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
3. Overview of Java Script
A number of Technologies are present that develops
the static web page, but we require a language that is
dynamic in nature to develop web pages.
JavaScript was created by Brendan Eich in 1995 at
Netscape Communications.
JavaScript was the first client-side scripting language
developed by Netscape.
JavaScript made its first appearance in Netscape 2.0 in
1995 with the name LiveScript.
4. JavaScript is an object-based client-side scripting
language that is popular and used to create dynamic and
interactive web pages.
Javascript is an interpreted language usually used with
HTML, and programs written in JavaScript are called
lightweight scripts.
JavaScript is a simple language which is only suitable for
simple tasks.
5. Features:
JavaScript is a lightweight, interpreted programming
language.
Designed for creating network-centric applications.
Complementary to and integrated with Java.
Complementary to and integrated with HTML.
Open and cross-platform
6. Java Script example program:
<html>
<head>
</head>
<body>
<script type = "text/javascript">
document. write("Hello World") ;
</script>
<p>This is web page body </p>
</body>
</html>
7. JavaScript variables
variables are containers for storing data (storing data
values).
4 Ways to Declare a JavaScript Variable:
Using var
Using let
Using const
Using nothing
8. When to Use JavaScript var?
Always declare JavaScript variables with var,let, or const.
The var keyword is used in all JavaScript code from 1995
to 2015.
The let and const keywords were added to JavaScript in
2015.
If you want your code to run in older browsers, you must
use var.
9. Java Script Function:
A function is a group of reusable code which can be
called anywhere in your program.
JavaScript also supports all the features necessary to
write modular code using functions.
The basic syntax
<script type = "text/javascript">
<!–
function functionname(parameter-list) { statements }
//-->
</script>
10. Example program:
<html>
<body>
<script type = "text/javascript">
function sayHello()
{
document.write ("Hello….!");
document.write (“Welcome to Java Script!");}
sayHello();
</script>
</body>
</html>
11. Calling a Function:
<html>
<head>
<script type = "text/javascript">
function sayHello()
{ document.write ("Hello there!");
}
</script>
</head> <body>
<p>Click the following button to call the function</p>
<form>
<input type = "button" onclick = "sayHello()" value =
"Say Hello">
</form> </body> </html>
12. JavaScript conditional statemenst :
Conditional statements are used to decide the flow of
execution based on different conditions. If a condition is
true, you can perform one action and if the condition is
false, you can perform another action.
There are mainly three types of conditional statements
If statement
If…else statement
If…else If…else statement
13.
14. if statement
The if statement is the fundamental control statement that
allows JavaScript to make decisions and execute
statements conditionally.
Syntax
if (expression)
{
//Statement(s) to be executed if expression is true
}
15. if...else statement
The 'if...else' statement is the next form of control statement
that allows JavaScript to execute statements in a more
controlled way.
Syntax
if (expression)
{ Statement(s) to be executed if expression is true
}
else
{ Statement(s) to be executed if expression is false
}
16. if...else if... statement
The if...else if... statement is an advanced form of if…else that
allows JavaScript to make a correct decision out of several
conditions.
Syntax
if (expression 1)
{ Statement(s) to be executed if expression 1 is true }
else if (expression 2)
{ Statement(s) to be executed if expression 2 is true }
else if (expression 3)
{ Statement(s) to be executed if expression 3 is true }
else { Statement(s) to be executed if no expression is true }
17. JavaScript Switch Statement
The switch statement is used to perform different actions based
on different conditions.
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}
18. JavaScript Loops
The JavaScript loops are used to iterate the piece of
code using for, while, do while or for-in loops. It makes the
code compact. It is mostly used in array.
There are four types of loops in JavaScript.
for loop
while loop
do-while loop
for-in loop
19. JavaScript For loop
The JavaScript for loop iterates the elements for the fixed
number of times. It should be used if number of iteration is
known. The syntax of for loop is given below.
for (initialization; condition; increment)
{
code to be executed
}
20. JavaScript while loop
The JavaScript while loop iterates the elements
for the infinite number of times. It should be used
if number of iteration is not known. The syntax of
while loop is given below.
while (condition)
{
code to be executed
}
21. JavaScript do while loop
The JavaScript do while loop iterates the elements for
the infinite number of times like while loop. But, code
is executed at least once whether condition is true or false.
The syntax :
do{
code to be executed
}while (condition);
22. for...in statement
The for...in statement iterates a specified variable over all the
enumerable properties of an object.
For each distinct property, JavaScript executes the specified
statements.
statement looks as follows:
for (key in object)
{
// body of for...in
}
23. <script type = "text/javascript">
const student =
{
name: 'komali',
class: 7,
age: 12
}
for ( let key in student )
{
document.write(`${key} => ${student[key]}`);
document.write("<br>");
}
</script>
24. pop-up boxes in JavaScript
In Javascript, popup boxes are used to display the message or
notification to the user.
There are three types of pop-up boxes in JavaScript namely
Alert Box,
Confirm Box and
Prompt Box.
25. Alert Box
Alert Box is the Java script message box that inform or alert the
user by displaying some messages in a small dialogue box
Syntax:
alert(string)
Whenever an alert box pops up, the user will have to click "OK"
button to proceed to next step
25
27. Confirm Box:
Javascript confirm box is often used if you want the
user to make a choice. When Java script pops up a
confirm box , the user will have to click either "OK" or
"Cancel" to proceed the next step.
Two different actions will occur depending on which
button the user clicks. If the user clicks "OK", the
confirm box returns true and if the user clicks "Cancel",
the Confirm box returns false
Syntax:
confirm(string)
28. Confirm():
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a confirm box.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
confirm("Press a button!");
}
</script></body> </html>
29. Prompt Box:
Java script Prompt Box is often used if you want the
user to enter an input value before proceed to the next
step.
When Java script display prompt box , the user will
have to click either "OK" or "Cancel" to proceed after
entering an input value.
If the user clicks "OK" the box returns the input value
and if the user clicks "Cancel" the box returns null
31. prompt():
<html>
<head>
<script type = "text/javascript">
function getValue() {
var Val = prompt("Enter your name : ", "your name
here");
document.write(“welcome: " + Val);
}
</script> </head> <body>
<p>Click the following button to see the result: </p>
<form>
<input type = "button" value = "Click Me" onclick =
"getValue();" />
</form> </body> </html>
32. Advance JavaScript
JavaScript Objects
A java Script object is an entity having state and behavior
(properties and method).
JavaScript is an object-based language. Everything is an
object in JavaScript.
JavaScript is template based not class based. Here, we
don't create class to get the object. But, we direct create
objects
JavaScript has several built-in objects, like String, Date,
Array, and more.
33. Creating a JavaScript Object
With JavaScript, you can define and create your own objects.
There are different ways to create new objects:
By object literal
By creating instance of Object directly (using new
keyword)
By using an object constructor (using new keyword)
34. By object literal
This is the easiest way to create a JavaScript Object.
Using an object literal, you both define and create an object in
one statement.
An object literal is a list of name:value pairs (like age:50)
inside curly braces {}.
Syntax:
object={property1:value1,property2:value2.....propertyN:value
N}
Example:
const person = {firstName:"John", lastName:"Doe", age:50,
eyeColor:"blue"};
35. This example creates an empty JavaScript object, and then
adds 4 properties:
Example
const person = {};
person.firstName = "John";
person.lastName = "Doe";
person.age = 50;
person.eyeColor = "blue"
36. By creating instance of Object
The syntax of creating object directly is given below:
var objectname=new Object();
Here, new keyword is used to create object.
example :
var emp=new Object();
emp.id=101;
emp.name="Ravi Malik";
emp.salary=50000;
37. By using an Object constructor
First you need to create function with arguments. Each
argument value can be assigned in the current object by
using this keyword.
function emp(id,name,salary)
{
this.id=id;
this.name=name;
this.salary=salary;
}
e=new emp(103,"Vimal Jaiswal",30000);
38. Defining method in JavaScript Object
We can define method in JavaScript object. But before
defining method, we need to add property in the function
with same name as method.
39. JavaScript Object Methods
Methods Description
Object.assign() This method is used to copy enumerable and
own properties from a source object to a
target object
Object.create() This method is used to create a new object
with the specified prototype object and
properties.
Object.getOwnPropertyDescr
iptors()
This method returns all own property
descriptors of a given object.
Object.getOwnPropertyName
s()
This method returns an array of all properties
(enumerable or not) found.
Object.getOwnPropertySymb
ols()
This method returns an array of all own
symbol key properties.
Object.getPrototypeOf() This method returns the prototype of the
specified object.
40. Object.is() This method determines whether two values are
the same value.
Object.isExtensible() This method determines if an object is extensible
Object.keys() This method returns an array of a given object's
own property names.
Object.values() This method returns an array of values
41. JavaScript own objects
JavaScript sports a number of built-in objects that extend
the flexibility of the language.
These objects are Date, Math, String, Array, and Object.
Several of these objects are "borrowed" from the Java
language specification, but JavaScript's implementation of
them is different.
42. Understanding the string object
the String object is the most commonly used. In the Netscape
2.0 JavaScript implementation, new string objects are
created implicitly using a variable assignment.
For example,
var myString = "This is a string";
43. length The length of a string
String Properties
String Methods
anchor Creates a named anchor (hypertext target)
big Sets text to big
blink Sets text to blinking
bold Sets text to bold
charAt Returns the character at a specified position
fixed Sets text in fixed-pitch font
fontcolor Sets the font color
fontsize Sets font size
indexOf Returns the first occurrence of character x starting from
position y
italics Sets text to italics
lastIndexOf Returns the last occurrence of character x starting from
position y
44. link Creates a hyperlink
small Sets text to small
strike Sets text to strikeout
sub Sets text to subscript
substring Returns a portion of a string
sup Sets text to superscript
toLowerString Converts a string to lowercase
toUpperString Converts a string to uppercase
45. Math Object:
JavaScript's Math object provides advanced arithmetic
and trigonometric functions, expanding on JavaScript's
basic arithmetic operators (plus, minus, multiply, divide).
The Math object in JavaScript is borrowed from Java
The Math object is static, so you don't need to create a
new Math object in order to use it. To access the
properties and method of the Math object, you merely
specify the Math object, along with the method or
property you wish
47. E Euler's constant
LN2 The natural logarithm of 2
LN10 The natural logarithm of 10
LOG2E The base 2 logarithm of e
LOG10E The base 10 logarithm of e
PI The numeric equivalent of PI: 3.14 etc.
SQRT1_2 The square root of one-half
SQRT2 The square root of 2
Math Properties
48. abs Returns the absolute value of a number
ceil Returns the least integer greater than or equal to a number
cos Returns the cosine of a number
exp Returns e (Euler's constant) to the power of a number
floor Returns the greatest integer less than or equal to its
argument
log Returns the natural logarithm (base e) of a number
max Returns the greater of two values
min Returns the lesser of two values
pow Returns the value of a number times a specified power
random Returns a random number (X-platforms only)
round Returns a number rounded to the nearest whole value
sqrt Returns the square root of a number
Math Methods
49. Date Object
Date object can be used in JavaScript to determine the
current time and date.
A popular JavaScript application of the Date object is
displaying a digital clock in a text box.
The script uses the Date object to update the clock once
every second.
JavaScript treats the Date object like a constructor class.
To use Date you must create a new Date object; you can
then apply the various Date methods to get and set
dates. (The Date object has no properties.)
50. getHours() - Returns the hour
getMinutes() - Returns the minutes
getSeconds() - Returns the seconds
getYear() - Returns the year ("96" is 1996)
getMonth() - Returns the month ("0" is January)
getDate() - Returns the day of the month
getDay() - Returns the day of the week ("0" is Sunday)
Examples:
var now = new Date(); var yearNow = now.getYear();
51. JavaScript Array
In JavaScript, an array is an ordered list of values. Each value
is called an element specified by an index
An array can hold values of mixed types.an array that
stores elements with the types number, string, Boolean, and
null.
the size of an array is dynamic and auto-growing.
There are 3 ways to construct array in JavaScript
By array literal
By creating instance of Array directly (using new keyword)
By using an Array constructor (using new keyword)
52. 1. JavaScript array literal
syntax
var arrayname=[value1,value2.....valueN];
Example:
var emp=["Sonoo","Vimal","Ratan“,1,2,3,4];
for (i=0;i<emp.length;i++)
{
document.write(emp[i] + "<br/>");
}
53. 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:
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>");
}
54. 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:
var emp=new Array("Jai","Vijay",“Ajay");
for (i=0;i<emp.length;i++)
{
document.write(emp[i] + "<br>");
}
55. Basic operations on arrays
1.Adding an element to the end of an array
2. Adding an element to the beginning of an array
3. Removing an element from the end of an array
4. Removing an element from the beginning of an array
5. Removing an element from the beginning of an array
6. Check if a value is an array
7.Retriving part of an array.(slice)
56. Methods
push() – Insert an element at the end of the array.
unshift() – Insert an element at the beginning of the array.
pop() – Remove an element from the end of the array.
shift() – Remove an element from the end of the array.
slice() – Create a shallow copy of an array.
Array.isArray() – Determine if a value is an array.
length – Determine the size of an array
57. Slice()
The slice() method cuts the array and returns a shallow copy
of a portion of an array into a new array object
It takes in two parameters: begin and end. The array is sliced
from the index specified as begin till the end index (end index
excluded).
The original array will not be modified.
If the end parameter is unspecified, the entire array from the
begin index is sliced.
58. Loop Over the Array Items
You can also loop over an array in case you need to access
multiple elements from the array at once.
We use the forEach method for this, which calls a function
once for each element in an array.
Example:
const fruits = ["apple", "orange", "cherry"];
fruits.forEach(myFunction);
59. DOM and web browser environments
When a web page is loaded, the browser create
a Document Object Model of the page.
with the object model, JavaScript gets all the power it needs to
create dynamic HTML:
JavaScript can change all the HTML elements in the page
JavaScript can change all the HTML attributes in the page
JavaScript can change all the CSS styles in the page
JavaScript can remove existing HTML elements and attributes
JavaScript can add new HTML elements and attributes
JavaScript can react to all existing HTML events in the page
JavaScript can create new HTML events in the page
60. JavaScript HTML DOM
The Document Object Model (DOM) is a programming
interface for and XML(Extensible markup language)
documents.
It defines the logical structure of documents and the way a
document is accessed and manipulated.
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents
"The W3C Document Object Model (DOM) is a platform and
language-neutral interface that allows programs and scripts to
dynamically access and update the content, structure, and style
of a document.“
62. The DOM Programming Interface
The HTML DOM can be accessed with JavaScript (and
with other programming languages).
In the DOM, all HTML elements are defined as objects.
A property is a value that you can get or set (like
changing the content of an HTML element).
A method is an action you can do (like add or deleting an
HTML element).
64. Window
The window is the browser tab that a web page is loaded into;
this is represented in JavaScript by the Window object.
Using methods available on this object you can know the
window's size
1.Window.innerWidth
2.Window.innerHeight
65. Navigator
The navigator represents the state and identity of the
browser (i.e. the user-agent) as it exists on the web.
In JavaScript, this is represented by the Navigator object.
You can use this object to retrieve things like the user's
preferred language, a media stream from the user's
webcam, etc.
66. Document
The document (represented by the DOM in browsers) is the
actual page loaded into the window, and is represented in
JavaScript by the Document object.
You can use this object to return and manipulate
information on the HTML and CSS.
67. Manipulation using DOM
When writing web pages and apps, one of the most common
things you'll want to do is manipulate the document
structure in some way.
This is usually done by using the Document Object Model
(DOM), a set of APIs for controlling HTML and styling
information that makes heavy use of the Document object.
68. Some JavaScript DOM selectors are:
getElementById() – Here, selection is based on the id name.
This selector returns only the first matched element.
getElementByClassName() – This method returns all
elements that match a specified class name.
getElementByTagName() – This method returns all the
elements that match a specific tag name.
querySelector() – This method returns the first element that
matches a specific CSS selector in the document.
querySelectorAll() – It returns all elements that match the
specified css selector in the document.
69. Example:
<html>
<body>
<div id = "test"> Hello world </div>
<script >
document.getElementById("test");
//styling the accessed element
document.getElementById('test').style.color = "pink";
</script>
</body>
</html>
70. forms and validations
JavaScript Form Validation
Before submitting data to the server, it is important to
ensure all required form controls are filled out, in the
correct format.
This is called client-side form validation, and helps
ensure data submitted matches the requirements set forth
in the various form controls
HTML form validation can be done by JavaScript.
71. If a form field (fname) is empty, this function alerts a
message, and returns false, to prevent the form from
being submitted
Example:
function validateForm()
{
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
72. Data Validation
Data validation is the process of ensuring that user input is
clean, correct, and useful. validation tasks are:
has the user filled in all required fields?
has the user entered a valid date?
has the user entered text in a numeric field?
73. 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.
74. <html> <head> <script type="text/javascript">
function printvalue()
{
var name=document.form1.uname.value;
document.writeln("Your
Name:"+name);//alert("Welcome: "+name);
}
</script>
<form name="form1">
Enter Name:<input type="text" name=“uname"/>
<input type="button" onclick="printvalue()"
value="PRINT VALUE"/>
</form>
</body> </html>
75. DHTML
DHTML stands for Dynamic Hypertext Markup
language i.e. Dynamic HTML.
Dynamic HTML is not a markup or programming language
but it is a term that combines the features of various web
development technologies for creating the web pages
dynamic and interactive.
Web pages may include animation, dynamic menus and text
effects.
The technologies includes combination of HTML, JavaScript
, CSS and DOM
76. Designed to enhance a Web user’s experience, DHTML
includes the following features:
Dynamic content, which allows the user to dynamically
change Web page content.
Dynamic positioning of Web page elements
Dynamic style, which allows the user to change the Web
page’s color, font, size or content
77. HTML (Hypertext Markup
language)
DHTML (Dynamic Hypertext Markup
language)
1. HTML is simply a markup
language.
1. DHTML is not a language, but it is a set of
technologies of web development.
2. It is used for developing and
creating web pages.
2. It is used for creating and designing the
animated and interactive web sites or pages.
3. This markup language creates
static web pages.
3. This concept creates dynamic web pages.
4. It does not contain any server-side
scripting code.
4. It may contain the code of server-side
scripting.
5. The files of HTML are stored with
the .html or .htm extension in a
system.
5. The files of DHTML are stored with the
.dhtm extension in a system.
6. A simple page which is created by
a user without using the scripts or
styles called as an HTML page.
6. A page which is created by a user using the
HTML, CSS, DOM, and JavaScript
technologies called a DHTML page.
7. This markup language does not
need database connectivity.
7. This concept needs database connectivity
because it interacts with users.
78. Events in DHTML
DHTML Events
An event is defined as changing the occurrence of an object.
It is compulsory to add the events in the DHTML page.
Without events, there will be no dynamic content on the
HTML page.
The event is a term in the HTML, which triggers the
actions in the web browsers.
Suppose, any user clicks an HTML element, then the
JavaScript code associated with that element is executed.
Actually, the event handlers catch the events performed by
the user and then execute the code.
79. Example of events:
Click a button.
Submitting a form.
An image loading or a web page loading, etc.
80. Event When it occurs
onclick It occurs when any user clicks on an HTML element.
ondblclick It occurs when the user clicks on an HTML element two times
together.
onfocus It occurs when the user focuses on an HTML element.
onkeydown It triggers when a user is pressing a key on a keyboard device.
This event handler works for all the keys.
onkeypress It triggers when the users press a key on a keyboard.
onkeyup It occurs when a user released a key from a keyboard after
pressing on an object or element.
onload It occurs when an object is completely loaded.
onmousemove It occurs when a user moves the cursor on an HTML object.
onmouseover It occurs when a user moves the cursor over an HTML object.
onmouseout It occurs or triggers when the mouse pointer is moved out of an
HTML element.
onsubmit It is triggered when the user clicks a button after the submission
of a form.
81. Advantages of DHTML
Those web sites and web pages which are created
using this concept are fast.
There is no plug-in required for creating the web page
dynamically.
Due to the low-bandwidth effect by the dynamic
HTML, the web page functionality is enhanced.
This concept provides advanced functionalities than
the static HTML.
It is highly flexible, and the user can make changes
easily in the web pages.
82. Disadvantages of DHTML
The scripts of DHTML does not run properly in
various web browsers. It is only supported by the latest
browsers.
The coding of those websites that are created using
DHTML is long and complex.
For understanding the DHTML, users must know
about HTML, CSS, and JavaScript. If any user does
not know these languages, then it is a time-consuming
and long process in itself.
83. XML
Introduction:
XML stands for Extensible Markup Language and
is a text-based markup language derived from
Standard Generalized Markup Language (SGML).
It was created by the World Wide Web Consortium
(W3C) to overcome the limitations of HTML.
XML tags identify the data and are used to store
and organize the data, rather than specifying how
to display it like HTML tags.
84. Why we need XML?
Since there are systems with different types of
operating systems having data in different formats.
In order to transfer the data between these systems
is a difficult task as the data needs to converted in
compatible formats before it can be used on other
system.
With XML, it is so easy to transfer data between
such systems as XML doesn’t depend on platform
and the language.
85. Characteristics of XML
XML is extensible − XML allows you to create your
own self-descriptive tags that suits your application.
XML carries the data, does not present it − XML
allows you to store the data irrespective of how it will
be presented.
XML is a public standard − XML was developed by
an organization called the World Wide Web
Consortium (W3C) and is available as an open
standard.
86. Similarities between HTML and XML?
1. Both are languages of web.
2. Both are markup languages.
3. Both are originated from SGML
4. Tags are basic building blocks of both HTML and XML
documents.
87. Differences between HTML and XML
1. HTML tags are predefined tags where as XML tags are
user defined tags.
2. HTML tags are limited number of tags where
as XML tags are extensible.
3. HTML tags are case insensitive where as XML tags
are sensitive.
4. HTML tags are meant for displaying the data but not
for describing the data
88.
89.
90. Describing the structure of an XML Document:
<?xml version = "1.0"?>
<contact-info>
<name>Kumar </name>
<company>HCL</company>
<phone>044- 123-4567</phone>
</contact-info>
there are two kinds of information in the above example −
Markup, like <contact-info>
The text, or the character data
91. The following diagram depicts the syntax rules to write
different types of markup and text in an XML document.
92. XML Declaration
The XML declaration is a piece of markup (which may
span multiple lines of a file) that identifies this as an XML
document
It is written as follows −
<?xml version="1.0" ?>
(OR)
<?xml version = "1.0" encoding = "UTF-8"?>
93. Syntax Rules for XML Declaration
The XML declaration is case sensitive and must
begin with "<?xml>" where "xml" is written in
lower-case.
If document contains XML declaration, then it
strictly needs to be the first statement of the XML
document.
An HTTP protocol can override the value
of encoding that you put in the XML declaration.
94. Building blocks of XML Documents
The basic building blocks of XML Document are
Elements
Tags
Attributes
Entities
PCDATA
CDATA
95. Components of an XML
Processing Instructions:
An XML Documents usually begins with the XML
declaration statement called the Processing
Instructions.
This statement provides information on how the XML
file should be processed.
e.g.
<?xml version =“1.0” encoding=“UTF-8”?>
The Processing Instruction statement uses the encoding
property to specify the encoding scheme used to create
the XML file.
96. 2. Tags:
Tags are used to specify a name for a given piece of
information. It is a means of identifying data. Data is
marked up using tags.
3. Elements:
Elements are the basic units used to identify and describe
the data in XML. They are the building blocks of an XML
document. Elements are represented using tags.
4. Content:
Content refers to the information represented by the elements
of an XML document.
Consider the following example:
<book_name>Web Programming</book_name >
97. 5. Attributes:
Attributes provide additional information about the
elements for which they are declared
example:
<book_name id = “101”> Web </ book_name >
6. Entities:
An entity is a name that is associated with a block of
data, such as chunk of text or a reference to an external
file that contains textual or binary information. It is a
set of information that can be specifying a single
name.
98. Tags and Elements
An XML file is structured by several XML-elements, also
called XML-nodes or XML-tags.
The names of XML-elements are enclosed in triangular
brackets < >
Element Syntax −
Each XML-element needs to be closed either with start or
with end elements as shown below −
<element>....</element>.
An element can contain:
text
attributes
other elements
99. XMLAttributes
XML elements can have attributes, just like HTML.
Attributes are designed to contain data related to a specific
element.
Attribute values must always be quoted. Either single or
double quotes can be used.
Example:
<person gender="female">
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
101. XML Validation
A well formed XML document can be validated against DTD
or Schema.
A well-formed XML document is an XML document with
correct syntax.
It is very necessary to know about valid XML document
before knowing XML validation.
102.
103. DTD(Document Type Declaration)
XML Document Type Declaration commonly known as DTD
is a way to describe precisely the XML language.
The purpose of a DTD is to define the legal building blocks
of an XML document.
It defines the document structure with a list of legal elements.
A DTD can be declared inline in your XML document, or as
an external reference.
DTDs check the validity of, structure and vocabulary of an
XML document against the grammatical rules of the appropriate
XML language.
104. Syntax:
<!DOCTYPE element DTD identifier
[ declaration1
declaration2 ........
]>
In the above syntax −
DTD starts with <!DOCTYPE delimiter.
An element tells the parser to parse the document from the
specified root element.
DTD identifier is an identifier for the document type
definition, which may be the path to a file on the system
or URL to a file on the internet.
The square brackets [ ] enclose an list of entity
declarations called internal subset.
105. A DTD can be declared inside an XML document as inline or
as an external recommendation.
DTD determines how many times a node should appear, and
how their child nodes are ordered.
There are 2 data types,
PCDATA is parsed character data.
CDATA is character data, not usually parsed.
106.
107. ELEMENT declaration:
A DTD element is declared with an ELEMENT keyword
When an XML file is validated by DTD, parser initially
checks for the root element
Syntax
<!ELEMENT elementname (content)>
ELEMENT declaration is used to indicate the parser that you
are about to define an element.
elementname is the element name (also called the generic
identifier) that you are defining.
content defines what content (if any) can go within the
element.
109. Declaring Attributes in DTD:
syntax:
<!ATTLIST element-name attribute-name attribute-type
default-value>
#DEFAULT value The attribute has a default value.
#REQUIRED The attribute value must be included in the
elemen
DTD example:
<!ATTLIST payment type CDATA "check">
<!ELEMENT Title (#PCDATA)>
<!ATTLIST Title lang CDATA #REQUIRED>
example:
<payment type="check" />
<title lang="english">The Road Ahead</title>
110. Declare Entities in DTD: :
entities are used to define shortcuts to special characters.
<!ENTITY entity-name "entity-value">
entity_name is the name of entity followed by its value
within the double quotes or single quote.
entity_value holds the value for the entity name.
Example:
<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE author [
<!ELEMENT author (#PCDATA)>
<!ENTITY sj "RSV">
]>
<author>&sj;</author>
111. <?xml version="1.0" standalone="yes"?>
<!DOCTYPE Library [
<!ELEMENT Library (Book)>
<!ELEMENT Book (Author,Title)>
<!ELEMENT Author (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ATTLIST Title lang CDATA #REQUIRED> ]>
<Library>
<Book>
<author>Bill Gates</author>
<title lang="english">The Road Ahead</title>
</Book>
112. <Book>
<author>Sri Sri Paramahansa Yogananda</author>
<title lang=“Hindi“>God Talks with Arjuna: The Bhagavad
Gita
</title>
</Book>
<Book>
<author>SRI SRI</author>
<title lang=“Telugu“> Mahaprastanam </title>
</Book>
</Library>
114. Disadvantages of using DTD
It does not support the namespaces.
It supports only the text string data type.
It is not object oriented. Hence, the concept of inheritance
cannot be applied on the DTDs.
115.
116. XML Schema
XML Schema is commonly known as XML Schema
Definition (XSD) language.
It is used to describe and validate the structure and the
content of XML Documents.
It defines the elements, attributes and data types.
Schema element supports Namespaces.
117. Elements Declration:
elements are the building blocks of XML document.
An element can be defined within an XSD as follows −
<xs:element name = "x" type = "y"/>
example:
<xs:element name = "phone_number" type = "xs:int" />
Attributes Declration:
Attributes in XSD provide extra information within an
element. Attributes have name and typeproperty as shown
below −
<xs:attribute name = "x" type = "y"/>
120. Advantages of using XML Schema over DTD
Schema uses XML as language so you don’t have to learn
new syntax.
XML schema supports data types and namespaces.
You can use XML parser to parse the XML schema as well.
Just like XML, the XML schema is extensible which means
you can reuse the schema in other schema.
121.
122. Transforming XML using XSL and XSLT
XSL stands for EXtensible Stylesheet Language.
XSLT is for Transformation of XML document to other
formats.
XSL stands for EXtensible Stylesheet Language. It is a styling
language for XML just like CSS is a styling language for
HTML.