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

(72)

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! JavaScript: A “Quick and Dirty” Overview Stanford University Continuing Studies CS 22 Enhanced Web Site Design STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 2 OF 12 Table of Contents Table of Contents .......................................................... 2  Introduction to JavaScript .............................................. 3  Why use JavaScript? .................................................................................... 3  Scope ........................................................................................................ 3  Next Steps ................................................................................................. 3  Overview ..................................................................... 4  General Terms .............................................................. 5  Object Terms ............................................................... 6  Statement Terms .......................................................... 8  Resources .................................................................. 12  STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 5 OF 12 General Terms Action: This property is a reflection of the action attribute in an HTML <form> 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 <script> tag. STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 6 OF 12 Object Terms Button: A form element that must be defined within a <form> tag used to perform an action Checkbox: A form element that the users sets to “on” or “off” by clicking. It must be defined in a <form> tag. Date: Replaces a normal date type. Document: Created by the browser when a page containing information on the current document is loaded. These properties are defined within the <body> tag. Elements: Parts of a form (buttons, checkboxes, radio buttons, text, textarea, hidden, etc.) Form: A property of the document object. Each form in a document is a separate and distinct object that can be referenced using the form object. The form object is an array created as forms are defined through HTML tags. If the first form in a document is named OrderForm, then it could be referenced as document.OrderForm or document.forms[0]. Frame: A window that contains HTML sub-documents that are independently scrollable Link: A location document. In addition to providing information about hypertext links, the link object can be used to define new links. Location: Contains complete URL information for the current document, while each property of location contains a different portion of the URL Math: Includes properties for mathematical constants and methods for functions Password: Created by HTML, password text fields are masked when entered by the user Reset: Correlates with an HTML reset button, which resets all form objects to their default values. Select: A selection list or scrolling list on an HTML form. String: A series of characters defined by double or single quotes. For example: myCat=“Domestic Short Haired” STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 7 OF 12 Submit: Causes the form to be sent to the CGI program specified in the ACTION attribute. Text: A one-line input field. Textarea: Similar to a text object, with the addition of multiple lines. A textarea object can also be updated by assigning new contents to its value. Window: Created by the browser when a web page is loaded containing properties that apply to the whole page. It is the top-level object for each document, location, and history object. Because its existence is assumed, you do not have to reference the name of the window when referring its objects, properties, or methods. STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 10 OF 12 Var: Declares a variable and optionally initializes it to a value. The scope of a variable is the current function, or, when declared outside a function, the current document. Var variableName=value, variableName2=value2 While: Repeats a loop as long as an expression is true. while (condition) { statements } With: Establishes a default object for a set of statements. Any property references without an object are assumed to use the default object. with (object) { statements } STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 11 OF 12 The with statement is useful when applied to the Math object for a set of calculations. For example: with (Math) { var Value1 = cos(angle); var Value2 = sin(angle); } would replace: { var Value1 = Math.cos(angle); var Value2 = Math.sin(angle); } STANFORD UNIVERSITY CONTINUING STUDIES CS 22 JAVASCRIPT PAGE 12 OF 12 Resources Web Tutorials: • Online courses (and hundreds of books) on JavaScript are available to the Stanford community at TechPort (SUNet ID required): http://techport.stanford.edu • JavaScript resources on the Web: http://echoecho.com/javascript.htm http://www.webmonkey.com/programming/javascript/ Web Sites Offering Free JavaScripts: • http://www.javascriptsource.com/ • http://www.free-javascripts.com/ • http://www.java-scripts.net/ • http://www.javascriptcity.com/scripts/ You can also download JavaScripts from the Adobe Exchange: http://www.adobe.com/cfusion/exchange/ Books: • JavaScript: The Complete Reference by Thomas Powell (McGraw Hill) ISBN: 0-07-225357-6 • JavaScript: A Beginner’s Guide by John Pollock (Osborne) ISBN: 0-07-213140-3 • HTML and JavaScript Basics by Karl Barksdale and E. Turner (Thompson: Course Technology) ISBN: 0-619-05991-5
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved