Java/J2EE Brain » 'Javascript tutorial basics'

Javascript tutorial basics

 

When you want to learn javascript , you need to know what objects, events, methods, and properties are in javascript. This tutorial will teach by example, without focusing too heavily on OOP vocabulary. However, you will need a basic understanding of these terms to use other JavaScript references.

Objects and Properties

Your web page document is an object. Any table, form, button, image, or link on your page is also an object. Each object has certain properties (information about the object). For example, the background color of your document is written document.bgcolor. You would change the color of your page to red by writing the line: document.bgcolor=”red”

 

The contents (or value) of a textbox named “password” in a form named “entryform” is document.entryform.password.value.

Methods

Most objects have a certain collection of things that they can do. Different objects can do different things, just as a door can open and close, while a light can turn on and off. A new document is opened with the method document.open() You can write “Hello World” into a document by typing document.write(”Hello World”) . open() and write() are both methods of the object: document.

 

Events

Events are how we trigger our functions to run. The easiest example is a button, whose definition includes the words onClick=”run_my_function()”. The onClick event, as its name implies, will run the function when the user clicks on the button. Other events include OnMouseOver, OnMouseOut, OnFocus, OnBlur, OnLoad, and OnUnload.

Read this materials also:
  • JavaScript Functions
  • JavaScript basics
  • What can a JavaScript do
  • What is JavaScript
  • Ajax Example
  • Tiles tutorial
  • Struts1 vs Struts2
  • Mastering Ajax
  • Input and Output - Java tutorial
  • Inheritance and class extensions - Java Tutorial
  • Leave a Reply

      
    Google-Translate-Chinese (Simplified) BETA Google-Translate-English to French Google-Translate-English to German Google-Translate-English to Italian Google-Translate-English to Japanese BETA Google-Translate-English to Korean BETA Google-Translate-English to Russian BETA Google-Translate-English to Spanish
    Java J2EE Tutorials, J2EE Study Materials,J2EE PDF Guides,Ajax Study materials,Ajax tutorials, Hibernate tutorials,JMS,JSP,EJB,JDBC,UML,XML,Java J2EE Jobs, Interview Questions, FAQs,Struts,Ejbs,Servlets, Java Softwares Post your articles, source codes, tips, comments or any information about Java/J2EE that you want to share with others at j2eebrain.support@gmail.com
    Custom Search