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

JavaScript Overview for Beginners: CS 22 at Stanford University, Assignments of Designs and Groups

JavaScript ProgrammingWeb DevelopmentHTML and CSS

An introduction to JavaScript, a programming language used to enhance web page functionality. It covers the basics of JavaScript, including why it's used, its placement in HTML, and general terms and concepts. Students will learn about actions, event handlers, functions, objects, properties, scripts, and more.

What you will learn

  • What is an event handler in JavaScript?
  • Where should JavaScript be placed in HTML?
  • What is the difference between a function and a method in JavaScript?
  • What are the basic terms and concepts in JavaScript?
  • What is JavaScript and why is it used?

Typology: Assignments

2021/2022

Uploaded on 07/05/2022

tanya_go
tanya_go 🇦🇺

4.7

(71)

1K documents

Partial preview of the text

Download JavaScript Overview for Beginners: CS 22 at Stanford University and more Assignments Designs and Groups in PDF only on Docsity!

JaJavvaaSSccrriipptt::

A “A “QQuuiicckk aanndd DDiirrttyy””

OvOveerrvviieeww

Stanford University Continuing Studies CS 22

Enhanced Web Site Design

S TANFORD UNIVERSITY C ONTINUING S TUDIES CS 22 JAVASCRIPT

  • Table of Contents.......................................................... Table of Contents
  • Introduction to JavaScript
    • Why use JavaScript?
    • Scope
    • Next Steps
  • Overview
  • General Terms..............................................................
  • Object Terms
  • Statement Terms
  • Resources

S TANFORD UNIVERSITY C ONTINUING S TUDIES CS 22 JAVASCRIPT

Introduction to JavaScript

Developed by Netscape, JavaScript is the easiest way to write small scripts for specific functions. The scripts are written directly into the HTML code and can be used to enhance both the look and overall functionality of your Web site.

Why use JavaScript?

JavaScript is a simple programming language that allows web developers to add interactivity and improve the look and feel of a web page. It is used to code events, objects, and actions, thus creating client and server Internet applications. As an interpreted language, there’s nothing to download, and it is not computer specific. It will work as long as your system has a JavaScript-capable browser (such as Internet Explorer , Firefox , or Netscape ) to interpret the code.

JavaScript is commonly used to create image rollovers, pop-up windows, forms, clocks, calculators, and a variety of other dynamic objects and functions. It can also be used to perform an action, such as playing an audio file or displaying a pop-up text box.

Note: Support for JavaScript varies among different browser brands and versions. For best results, use the latest version of the browser.

Scope

This is designed to be a simple overview of JavaScript and to familiarize students with the terms and concepts used in creating and editing JavaScript programs.

After this section, you will be able to:

  • Understand what JavaScript programs can do
  • Understand how to edit existing JavaScript programs
  • Understand how to obtain JavaScript programs that others have created and use them in your own web pages

Next Steps

This is not designed to teach you everything you will need to know to create your own JavaScript programs. The next steps in training could include:

  • Taking a class in JavaScripting at a local community college or computer institute
  • Reading books on JavaScripting
  • Viewing online training and tutorials

For some suggestions, see the Resources section at the end of this handout.

S TANFORD UNIVERSITY C ONTINUING S TUDIES CS 22 JAVASCRIPT

Overview

JavaScript can be placed anywhere in the HTML as long as it stays within its tags:

) indicates the actual JavaScript. Everything between the will be ignored by browsers that cannot process the script.

The code // tells the browser to ignore the following text and to exclude it from the JavaScript.

The following code is used to indicate a function:

function someFunction ()

{JavaScript statements }

This is where the actual JavaScript goes. The brackets {} separate the statements in the function.

To end a JavaScript, the following code is used:

//-->

S TANFORD UNIVERSITY C ONTINUING S TUDIES CS 22 JAVASCRIPT

General Terms

Action: This property is a reflection of the action attribute in an HTML

tag, including the forms destination URL.

Cookie: An object containing client information that can be accessed by the server

Event Handler: Attributes of HTML tags embedded in documents. The attribute assigns a JavaScript command or function to execute when the event occurs

Function: A user-defined or built-in set of statements that perform a task. It can also return a value when used with the return statement.

Java: An object-oriented, platform-independent programming language developed by Sun Microsystems used to provide additional functionality to Web pages. Programming in Java requires a Java Development Kit with compiler and core classes.

Literal: An absolute value not defined by a variable. Examples: 1, 3.1415927, “Bob”, false, true.

Method: A function assigned to an object. For example, bigStringtoUpperCase(); returns an uppercase version of the string contained in bigString.

Object: A construct with properties that are JavaScript variables or other objects. Functions associated with an object are known as the object’s methods.

Property: Describes an object. A property is defined by assigning it a value. There are several properties in JavaScript that contain constants (values that never change).

Protocol: Returns a string with the initial portion of the URL, which indicates the access method (http://, ftp://, mailto:, etc.).

Script: One or more JavaScript commands enclosed in a