Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Quarter 3 Week 1 .Net2 Module Javascript PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

INTRODUCTION

JavaScript
Competency
Create static pages using new
features available in HTML5
What is JavaScript
JavaScript is a dynamic computer programming language.
It is lightweight and most commonly used as a part of web pages,
whose implementations allow client-side script to interact with the
Will you appear
user and make
in the dynamic pages.
video?
It is an
Whatinterpreted
will your programming language with object-oriented
surroundings
capabilities. be?

JavaScript was first known as LiveScript, but Netscape changed its


name to JavaScript, possibly because of the excitement being
generated by Java.
JavaScript made its first appearance in Netscape 2.0 in 1995 with the
name LiveScript. The general-purpose core of the language has been
embedded in Netscape, Internet Explorer, and other web browsers.
Applications of Javascript
Programming
Client side
Will you appear
in the video?
validation
Manipulating
What will your
surroundings be?
HTML Pages
User Notifications
Back-end Data Loading
Presentations
Server Applications
Client-Side JavaScript
The script should be included in or referenced by an HTML
document for the code to be interpreted by the browser.It
means that a web page need not be a static HTML, but can
include programs that interact with the user, control the
browser, and dynamically create HTML content.
The JavaScript client-side mechanism provides many
advantages over traditional CGI server-side scripts. For
example, you might use JavaScript to check if the user has
entered a valid e-mail address in a form field.The
JavaScript code is executed when the user submits the
form, and only if all the entries are valid, they would be
submitted to the Web Server.JavaScript can be used to trap
user-initiated events such as button clicks, link navigation,
and other actions that the user initiates explicitly or
implicitly.
Advantages of JavaScript

Less server interaction


Immediate feedback to
the visitors
Increased interactivity
Richer interfaces
Advantages of JavaScript

Less server interaction


Immediate feedback to
the visitors
Increased interactivity
Richer interfaces
Limitations of JavaScript
Client-side JavaScript does not
allow the reading or writing of files.
JavaScript cannot be used for
networking applications because
there is no such support available.
JavaScript doesn't have any multi-
threading or multiprocessor
capabilities.
JavaScript Development Tools

Microsoft FrontPage
Macromedia
Dreamweaver MX
Macromedia HomeSite 5
JavaScript - Syntax
JavaScript can be implemented using
JavaScript statements that are placed
within the <script>... </script> HTML tags
in a web page.
You can place the <script> tags,
containing your JavaScript, anywhere
within your web page, but it is normally
recommended that you should keep it
within the <head> tags.
JavaScript - Syntax

Simple syntax of your JavaScript

<script ...>
JavaScript code
</script>
Two important attributes of
the script tag
Language − This attribute specifies
what scripting language you are
using. Typically, its value will be
javascript.
Type− This attribute specifies what
scripting language you are using.
Typically, its value will be
javascript.
First JavaScript Code
<html>
<body>
<script language = "javascript" type =
"text/javascript">
<!--
document.write("Hello World!")
//-->
</script>
</body>
</html>This code will produce the following result
Sample JavaScript Code
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p>JavaScript can change HTML attribute values.</p>

<p>In this case JavaScript changes the value of the src (source)
attribute of an image.</p>

<button
onclick="document.getElementById('myImage').src='pic_bulbon.gif'">
Turn on the light</button>
Con"t. Sample JavaScript Code

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button
onclick="document.getElementById('myImage').src='pic_bulboff.gif'"
>Turn off the light</button>

</body>
</html>
activity 1

Write a javascript that will apply for turn on light and


turn off the light .
THANK YOU FOR
BEING HERE!

You might also like