Search results for 'Object'. 1 post(s) found.
- 2007/08/26 Example Of Creating Objects
an example of creating Object in javascript,
taken from http://www.wdvl.com/Authoring/JavaScript/Tutorial/Objects.html
direct instance of an Object
Despite the awkward sound name, a "direct instance of an Object" simply means creating a new single Object, such as myPetDog:
Assigning a method to your new Object is also simple. Assume that you already have coded a function named woof(), which causes a barking sound to play:
myPetDog.woof=woof;
prototype of an Object
Sometimes, you'll want to create a "template" or prototype of an Object. This does not create an actual instance of the Object, but defines the structure of the Object. In the future, then, you can quickly stamp out a particular instance of the Object. Suppose that instead of myPetDog, you created a prototype Object named petDog. This Object could then be a template for a particular pet dog Object. First, create a function which defines the petDog structure:
function petDog(name, breed, year)
{
this.name = name;
this.breed = breed;
this.year = year;
}
{
this.name = name;
this.breed = breed;
this.year = year;
}
Now that the petDog prototype has been set, you can quickly create single instances of a new Object based on the petDog structure:
Another posts included in "HTML, Javascript"
| Printing A Page (0) | 2007/08/26 |
| Cross Browser Event Management Functions Using JavaScript (0) | 2007/08/29 |
| Javascript & Cookie based Visitor Application (0) | 2007/08/29 |
| Shake Your Window.... (0) | 2007/08/26 |
| Linking Drop Downs (0) | 2007/08/26 |
| Roman Numerals From Integers (0) | 2007/08/26 |
| Get A Print Dialog Box By Clicking A Button (0) | 2007/08/26 |
| Keyboard event detection (Key Tracker) (0) | 2007/08/26 |
Trackback : Cannot send a trackbact to this post.
-
Subject Cialis viagra levitra.
2009/05/24 14:09
How does levitra work. Comparison levitra cialis. Levitra.
-
Subject Buy levitra online.
2009/05/30 11:31
Levitra dosage. Levitra side effects. Levitra attorneys. Cialis viagra levitra. Cheapest generic levitra. Levitra.
-
Subject Vicodin.
2009/07/26 04:03
Signs of vicodin addictio.
-
Subject different money making ideas
2010/01/29 03:57
moneyideas
-
Subject different money making ideas
2010/01/29 12:55
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed