home

Chapter 9: Integrating JavaScript and HTML


Chapter 1 | Chapter 2 | Chapter 3 | Chapter 4 | Chapter 5 | Chapter 6
Chapter 7 | Chapter 8 | Chapter 9 | Chapter 10 | Chapter 11 | Chapter 12


JavaScript:
An event driven, object-based, programming language that provides various types of functionality to Web pages, such as the ability to interact with the user.
Event Driven::
A programming language that responds to events, such as a user clicking a Submit or Calculate button.
Object-Based:
A scripting language that uses built-in objects that belong to the browser.
Built-in Objects:
Values that are common to a browser (arrays, dates, strings, etc.), and neither depend on nor belong to another object.
Properties:
Attributes that describe an object's characteristics.
Methods:
Actions that an object can perform.
Argument:
A value given to a method.
User-Defined Function:
JavaScript code written by a Web developer to perform a particular task.
Global Functions:
Built-in functions in Javascript such as close(), open(), and print().
Event:
The result of an action, such as a mouse click or a dcument loading.
Event Handler:
JavaScript's way to associate an action with a function.
Variables:
Values that are Stored temporarily in internal memory.
Global:
The variable value is available for use anywhere inside the HTML file Web page.
Local:
The variable's value is available only in the functions in which it is defined.
Data Type:
The type of data that a variable is stored as. There are four data types in JavaScript.
  1. Numeric Data Types hold numbers.
  2. String Data Types are variables that hold characters or a combination of letters, numbers, or symbols.
  3. Date Data Types contain a date and time.
  4. Boolean Data Types contain logical data that can be one of two values, such as True/False or Yes/No.
Loosely Typed:
JavaScript variables do not have to be assigned an initial specific data types as in other programming languages.
Keyword/Reserved Word:
A word with special meaning in a programming language.
Object Instance Variable:
A JavaScript statement used to create a new object instance using the new keyword and assigning the built-in object to a variable.
Relative Address:
The location of a byte in a string of bytes, as defined by its position relative to the first byte in that string.
Concatenate:
A word commonly associated with JavaScript that means to join or link together.
Call:
To call a function means to have JavaScript execute the function.
SelectedIndex:
Property of the select list that returns the value of the selected item when a user selects an item in the select list.
Triggers:
JavaScript's way of executing an associated function once the event is captured by calling, or triggering the JavaScript user-defined function.


Other Notes

  1. JavaScript is THE scripting language of the internet. It is the most commonly used scripting language and the most supported.
  2. JavaScript's official name is ECMAScript. The standard is developed and maintained by the ECMA organization.
  3. JavaScript code can be placed anywhere in a webpage. It is also possible to create external .js files and link them to your page.
  4. Check out w3schools.org to learn more about javascript.
  5. A user must allow JavaScript to display in their browser by enabling it.
  6. Javascript is a case and space sensitive language, for it to display, the code must follow its own pre-defined rules and standards.
  7. Most of my practice with javascript came from online sources, and I mostly only used the book for definitions.


Objects and Associated Event Handlers
Object Event Handler
button onClick, onDblClick
document onLoad, onUnload
form onSubmit, onReset, onBlur, onKeydown, onKeypress, onKeyup
hyperlink onClick, onMouseover, onMouseout, onDblClick, onMousemove, onMousedown
image onLoad, onAbort, onError, onMousemove, onMousedown
input box onBlur, onChange, onFocus, onKeypress, onKeyup, onKeydown
Submit button onClick
window onLoad, onUnload, onBlur, onFocus


JavaScript Examples.

These are some basic examples of what can be done with JavaScript code in a webpage.






  • Put your mouse over the button.


  • This is an alert button.



  • This is a confirm button.



  • This is a prompt button.


This is a great example of what can be done in a webpage with javascript. I did not create this script, however I fully understand it and I was able to edit and re-create it for consistency with the rest of my website.
Home
Ind_Study
Portfolio
Contact
W3C
This is an example of what javascript can do in a webpage.

I did not create this, click here to see where I found it.


Source Code:
Chapter 1 | Chapter 2 | Chapter 3 | Chapter 4 | Chapter 5 | Chapter 6
Chapter 7 | Chapter 8 | Chapter 9 | Chapter 10 | Chapter 11 | Chapter 12

top |< back | next >|

Valid XHTML 1.0 Transitional