banner

Javascript Tutorial - Part 2

This is the second part of a two part tutorial for javascript. This is a link to w3c.org for more information.

These are basic JavaScript Commands

    Basics



    Pop Up Boxes

  • alert - Displays an alert box
  • confirm - displays a confirmation box
  • prompt - displays a prompt box
  • Variable Creation

  • var - creates a variable
  • Operators

  • + addition
  • ++ increment by 1
  • - subtraction
  • -- de increment by 1
  • * multiplication
  • / division
  • % modulous
  • Comparison Operators

  • == equal to
  • === strict equal to
  • != not equal to
  • <= less than or equal to
  • >= greater than or equal to
  • > greater than
  • < less than
  • Conditional Statements

  • if - only executes if a specific condition is true
  • if..else - executes if a specific condition is true, if its not then it executes the next block of code
  • if..else if..else - executes if a specific condition is true, if it's not then it checks the next statement and executes if that condition is true, if it is not then it executes the last block of code
  • switch - gives options to the user to execute a specifec block of code. Almost like a choose your own adventure book
  • Functions

  • function anyNameHere(){} - used to declare a function
  • Loops

  • for - executes a specific, defined number of times
  • while - executes while a specific condition is not true
  • Events

  • onMouseOver - does a specified action when the cursor is over an object
  • onMouseOut - does a specified action when the cursor is moved from an object
  • onFocus, onChange, onBlur - used to validate user data inside of a form when the cursor is moved
  • onSubmit - used to validate form fields before submission
  • String Objects

  • length - returns the length of a string to a function
  • anchor() - creates an html anchor
  • big() - creates text in a big font
  • blink() - creates blinking text
  • bold() - displays text in a bold font
  • charAt() - returns text in a specific location
  • concat() - concatenates two strings together
  • split() - splits a string into an array of strings
  • substr() - extracts specific number of characters in a string from a specified starting position
  • toLowerCase() - displays specified text in lower case
  • toUpperCase() - displays specified text in upper case
  • valueOf() - returns the primitive value of a string
  • Date Object

  • date() - specifies or sets a specific date
  • DOM Objects

  • document - represents the document of the web page
  • image - represents a documents image
  • form - represents a documents form
  • button - represents a button on the web page
  • anchor - represents an anchor tag on the web page
  • frame - represents a frame on the web page
  • frameset - represents a frameset tag
  • iframe - represents an iframe
  • input button - represents a form button
  • input checkbox - represents a forms checkbox
  • input file - represents a file upload option
  • input hidden - represents a hidden object
  • input password - represents a password box in a form
  • input submit - represents a form submit button
  • input reset - represents a form reset button
  • input radio - represents a form radio button
  • input text - represents a form text box
  • textarea - represents a text area
  • table - represents a table
  • tablerow - represents a row inside of a table
  • tabledata - represents a cell inside of a table
  • body - represents the documents body tag
  • area - represents an image maps area tag
  • event - represents an event of an element


  • [Home] [page1-HTML] [page2-CSS] [page4-JavaScript-Part1] [page5-PHP]

We are working on this page, will be up shortly. If you have any suggestions for future tutorials please feel free to email us at ghost@webdevelopmentsolutions.org.