prototype − overview - − overview.....1 what is prototype ... 2. prototype − useful...

Download PROTOTYPE − OVERVIEW -    − OVERVIEW.....1 What is Prototype ... 2. PROTOTYPE − USEFUL FEATURES

Post on 23-May-2018

213 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

  • Prototype

    i

    About the Tutorial

    This tutorial gives a complete understanding on Prototype. Prototype is distributed as a

    single file called prototype.js. Prototype is an object in javascript from which other objects

    inherit properties.

    Audience

    This tutorial has been written for users willing to learn the Javascript Prototype object and

    its usage. Beginners as well as experienced users can refer this tutorial to brush up or

    learn the Javascript prototypes.

    Prerequisites

    To learn prototype you should have the basic knowledge of Javascript and its properties.

    Copyright & Disclaimer

    Copyright 2016 by Tutorials Point (I) Pvt. Ltd.

    All the content and graphics published in this e-book are the property of Tutorials Point (I)

    Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish

    any contents or a part of contents of this e-book in any manner without written consent

    of the publisher.

    We strive to update the contents of our website and tutorials as timely and as precisely as

    possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.

    Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our

    website or its contents including this tutorial. If you discover any errors on our website or

    in this tutorial, please notify us at contact@tutorialspoint.com

    mailto:contact@tutorialspoint.com

  • Prototype

    ii

    Table of Contents

    About the Tutorial ..................................................................................................................................... i

    Audience .................................................................................................................................................... i

    Prerequisites .............................................................................................................................................. i

    Copyright & Disclaimer .............................................................................................................................. i

    Table of Contents ...................................................................................................................................... ii

    1. PROTOTYPE OVERVIEW ...................................................................................................... 1

    What is Prototype ? .................................................................................................................................. 1

    How to Install Prototype? ......................................................................................................................... 1

    How to Use Prototype Library? ................................................................................................................. 1

    Why This Tutorial? .................................................................................................................................... 3

    2. PROTOTYPE USEFUL FEATURES .......................................................................................... 4

    Cross Browser Support .............................................................................................................................. 4

    The Document Object Model .................................................................................................................... 4

    HTML Forms .............................................................................................................................................. 4

    JavaScript Events ...................................................................................................................................... 4

    Ajax Utilities ............................................................................................................................................. 4

    3. PROTOTYPE UTILITY METHODS .......................................................................................... 5

    $() Method ................................................................................................................................................ 5

    Fetching Multiple Values Using $() ............................................................................................................ 7

    $$() Method .............................................................................................................................................. 9

    $A() Method ........................................................................................................................................... 11

    $F() Method ............................................................................................................................................ 13

    $H() Method ........................................................................................................................................... 14

  • Prototype

    iii

    $R() Method............................................................................................................................................ 16

    $w() Method ........................................................................................................................................... 18

    Try.these Method ................................................................................................................................... 20

    document.getElementsByClassName ...................................................................................................... 21

    4. PROTOTYPE ELEMENT OBJECT ......................................................................................... 22

    Prototype Element Method .................................................................................................................... 22

    absolutize() Method................................................................................................................................ 27

    addClassName() Method ........................................................................................................................ 28

    addMethods() Method............................................................................................................................ 30

    adjacent() Method .................................................................................................................................. 32

    ancestors() Method ................................................................................................................................ 33

    childElements() Method.......................................................................................................................... 35

    cleanWhitespace() Method ..................................................................................................................... 37

    clonePostion() Method ........................................................................................................................... 40

    cumulativeOffset() Method .................................................................................................................... 42

    cumulativeScrollOffset() Method ............................................................................................................ 43

    descendantOf() Method .......................................................................................................................... 45

    descendants() Method ............................................................................................................................ 47

    down() Method ....................................................................................................................................... 49

    empty() Method ..................................................................................................................................... 51

    extend() Method ..................................................................................................................................... 52

    fire() Method .......................................................................................................................................... 53

    firstDescendant() Method ....................................................................................................................... 55

    getDimensions() Method ........................................................................................................................ 57

    getHeight() Method ................................................................................................................................ 58

  • Prototype

    iv

    getOffsetParent() Method ...................................................................................................................... 60

    getStyle() Method ................................................................................................................................... 62

    getWidth() Method ................................................................................................................................. 63

    hasClassName() Method ......................................................................................................................... 65

    hide() Method ......................................................................................................................................... 67

Recommended

View more >