Module-5
Module-5
Dr.Ramu Vankudoth
Assistant Professor
MODULE V Client side Scripting
Client-side scripting refers to the execution of scripts on the user's web browser rather than on a
web server. It is primarily used to create dynamic and interactive web pages, enhance user
experience, and reduce server load.
</script>
</body>
</html>
Functions
JavaScript functions are used to perform operations. We can call JavaScript function many
times to reuse the code.
To declare a function we have to use the reserved keyword "function", followed by its
name, and a set of arguments. Function Syntax
1. A JavaScript function is defined with the function keyword, followed by a name,
followed by parentheses ().
2. Function names can contain letters, digits, underscores, and dollar signs (same rules
as variables).
3. The parentheses may include parameter names separated by commas:
(parameter1, parameter2, ...)
Functions are useful in organizing the different parts of a script into the several tasks
that must be completed. There are mainly two advantages of JavaScript functions.
1. Code reusability: We can call a function several times in a script to perform their
tasks so it saves coding.
2. Less coding: It makes our program compact. We don't need to write many lines of
code each time to perform a common task.
Mouse events:
Event Performed Event Handler Description
mouseover onmouseover When the cursor of the mouse comes over the element
mousedown onmousedown When the mouse button is pressed over the element
mouseup onmouseup When the mouse button is released over the element
Form events:
load onload When the browser finishes the loading of the page
resize onresize When the visitor resizes the window of the browser
• AJAX stands for Asynchronous JavaScript and XML, AJAX is not a programming
language or technology, but it is a combination of multiple web-related
technologies like HTML, XHTML, CSS, JavaScript, DOM, XML, XSLT and
XMLHttpRequest object.
• The AJAX model allows web developers to create web applications that are
able to interact with the user dynamically.
• It will also be able to quickly make a background call to web servers to retrieve
the required application data.
• AJAX applications are much more faster and responsive as compared to
traditional web applications.
How AJAX works?
• AJAX communicates with the server using XMLHttpRequest object.
• Let's try to understand the flow of ajax or how ajax works by the image displayed
below.
As you can see in the above example, XMLHttpRequest object plays a
important role.