Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Creating a Programmable Web Page - Introduction to Java Script - Lecture Slides, Slides of Javascript programming

Here is my collection on JavaScript lectures. It includes tutorials as well as general concepts explanations. Particularly these slides contain: Creating a Programmable Web Page, Server-Side Programs, Client-Side Programs, Hiding Script from Older Browsers, Javascript Syntax Issues, Declaring a Variable, Retrieving the Year Value, Math Methods, While Loop

Typology: Slides

2013/2014
On special offer
30 Points
Discount

Limited-time offer


Uploaded on 01/29/2014

surii
surii 🇮🇳

3.5

(13)

130 documents

1 / 63

Toggle sidebar
Discount

On special offer

Related documents


Partial preview of the text

Download Creating a Programmable Web Page - Introduction to Java Script - Lecture Slides and more Slides Javascript programming in PDF only on Docsity!

JavaScript

Creating a Programmable Web Page

Tutorial Objectives

  • Understand basic JavaScript syntax
  • Create an embedded and external script
  • Work with variables and data
  • Work with data objects and extract values from dates
  • Work with expressions and operators
  • Create and call a JavaScript function
  • Work with arrays and conditional statements
  • Learn about program loops

Server-Side Programs

  • a user must be connected to the Web server to run

the server-side script

  • only the programmer can create or alter the script
  • the system administrator has to be concerned about

users continually accessing the server and potentially

overloading the system

Client-Side Programs

  • solve many of the problems associated with server-side

scripts

  • can be tested locally without first uploading it to a Web

server

  • are likely to be more responsive to the user
  • can never completely replace server-side scripts

Introduction to JavaScript

  • JavaScript is an interpreted programming or script language from Netscape.
  • JavaScript is used in Web site development to such things as:

 automatically change a formatted date on a Web page

 cause a linked-to-page to appear in a popup window  cause text or a graphic image to change during a mouse rollover

Java vs. JavaScript

  • Requires the JDK to create the applet
  • Requires a Java virtual machine to run the applet
  • Applet files are distinct from the XHTML code
  • Source code is hidden from the user
  • Programs must be saved as separate files and compiled before they can be run
  • Programs run on the server side
    • Requires a text editor
    • Required a browser that can interpret JavaScript code
    • JavaScript can be placed within HTML and XHTML
    • Source code is made accessible to the user
    • Programs cannot write content to the hard disk
    • Programs run on the client side

ECMAScript

  • The responsibility for the development of a scripting
standard has been transferred to an international body
called the European Computer Manufacturers Association
(ECMA).
  • The standard developed by the ECMA is called
ECMAScript, though browsers still refer to it as JavaScript.
  • The latest version is ECMA-262, which is supported by the
major browsers.

Other Client-side Languages

  • Internet Explorer supports JScript.
  • JScript is identical to JavaScript, but there are some

JavaScript commands not supported in JScript, and vice

versa.

  • Other client-side programming languages are also

available to Web page designers, such as the Internet

Explorer scripting language, VBScript.

Example of Web Site using JavaScript

Writing a JavaScript Program

  • The Web browser runs a JavaScript program when the Web page is first loaded, or in response to an event.
  • JavaScript programs can either be placed directly into the HTML file or they can be saved in external files. - placing a program in an external file allows you to hide the program code from the user - source code placed directly in the HTML file can be viewed by anyone

Writing a JavaScript Program

  • A JavaScript program can be placed anywhere within the HTML file.
  • Many programmers favor placing their programs between tags in order to separate the programming code from the Web page content and layout.
  • Some programmers prefer placing programs within the body of the Web page at the location where the program output is generated and displayed.

Using the

  • To access an external script, use:

<script src=“ url ” type=“text/javascript”>

script commands and comments

Comments

  • The syntax for a single-line comment is:

// comment text

  • The syntax of a multi-line comment is:

/*

comment text covering several lines

*/

Hiding Script from Older Browsers

  • You can hide the script from these browsers using comment tags:
  • When a Web browser that doesn’t support scripts encounters this code, it ignores the