Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
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
Typology: Assignments
1 / 12
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:
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:
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