### Prototype Cheat Sheet 1.6.0.2 #### Event - **`element(event)`**: Returns the target element of an event. - **`extend(event)`**: Extends the functionality of an event object. - **`findElement(event, tagName)`**: Finds the first element under the target of an event that matches the specified `tagName`. - **`fire(element, eventName[, memo])`**: Programmatically triggers an event on the specified `element`. - **`isLeftClick(event)`**: Determines if the event was triggered by a left mouse click. - **`observe(element, eventName, handler)`**: Attaches an event handler to an element. - **`pointerX(event)`**: Retrieves the horizontal position of the mouse relative to the document when the event occurred. - **`pointerY(event)`**: Retrieves the vertical position of the mouse relative to the document when the event occurred. - **`stop(event)`**: Stops the propagation of an event and prevents its default action. - **`stopObserving(element[, eventName[, handler]])`**: Detaches an event handler from an element. #### Form - **`disable(formElement)`**: Disables all form elements within the specified form. - **`enable(formElement)`**: Enables all form elements within the specified form. - **`findFirstElement(formElement)`**: Finds the first child element of a form element. - **`focusFirstElement(formElement)`**: Sets focus on the first interactive element in a form. - **`getElements(formElement)`**: Retrieves all child elements of a form element. - **`getInputs(formElement[, type[, name]])`**: Retrieves input elements based on optional type and name filters. - **`request([options])`**: Sends an AJAX request using the specified options. - **`reset(formElement)`**: Resets the specified form to its initial state. - **`serialize(formElement[, getHash=false])`**: Serializes a form into a URL-encoded string for use in an AJAX request. - **`serializeElements(elements[, getHash=false])`**: Serializes a collection of elements into a URL-encoded string. #### Form.Element - **`activate(element)`**: Activates an element, typically by setting focus or enabling it. - **`clear(element)`**: Clears the value of an element. - **`disable(element)`**: Disables an element, preventing user interaction. - **`enable(element)`**: Enables an element, allowing user interaction. - **`focus(element)`**: Sets focus on an element. - **`getValue(element)`**: Retrieves the current value of an element. - **`present(element)`**: Determines if an element is present in the document. - **`select(element)`**: Selects an element, typically used for `<select>` elements. - **`serialize(element)`**: Serializes an element into a URL-encoded string. - **`setValue(element, value)`**: Sets the value of an element. #### Element (Constructor) - **`absolutize(element)`**: Converts the positioning of an element to absolute. - **`addClassName(element, className)`**: Adds a CSS class to an element. - **`addMethods([methods])`**: Adds methods to an element prototype. - **`adjacent(element[, selectors])`**: Selects adjacent elements based on CSS selectors. - **`ancestors(element)`**: Retrieves all ancestor elements of the specified element. - **`childElements(element)`**: Retrieves all direct child elements of an element. - **`classNames`**: Returns an array of all CSS classes applied to an element. - **`cleanWhitespace(element)`**: Removes extra whitespace from an element’s content. - **`clonePosition(element, source[, options])`**: Clones the positioning properties of one element to another. - **`cumulativeOffset(element)`**: Computes the cumulative offset of an element from the top-left corner of the document. - **`cumulativeScrollOffset(element)`**: Computes the cumulative scroll offset of an element. - **`descendantOf(element, ancestor)`**: Determines if an element is a descendant of another element. - **`descendants(element)`**: Retrieves all descendant elements of the specified element. - **`down(element[, cssRule][, index=0])`**: Selects a child element based on a CSS selector and an optional index. - **`empty(element)`**: Empties the contents of an element. - **`extend(element)`**: Extends the functionality of an element. - **`fire(eventName[, memo])`**: Triggers a custom event on the element. - **`firstDescendant(element)`**: Retrieves the first descendant element. - **`getDimensions(element)`**: Retrieves the dimensions of an element. - **`getElementsByClassName`**: Retrieves elements by their class name. - **`getElementsBySelector`**: Retrieves elements based on a CSS selector. - **`getHeight(element)`**: Retrieves the height of an element. - **`getOffsetParent(element)`**: Retrieves the offset parent of an element. - **`getStyle(element, property)`**: Retrieves the computed style of an element for a specific property. - **`getWidth(element)`**: Retrieves the width of an element. - **`hasClassName(element, className)`**: Checks if an element has a specific CSS class. - **`hide(element)`**: Hides an element. - **`identify(element)`**: Assigns a unique identifier to an element. - **`immediateDescendants`**: Retrieves immediate child elements. - **`insert(element, {position: content})`**: Inserts content at a specified position relative to an element. - **`inspect(element)`**: Returns a string representation of an element, useful for debugging. - **`makeClipping(element)`**: Sets clipping on an element, allowing it to clip its content. - **`makePositioned(element)`**: Ensures that an element has a position style set. - **`match(element, selector)`**: Determines if an element matches a CSS selector. - **`next(element[, cssRule][, index=0])`**: Selects the next sibling element based on a CSS selector and an optional index. - **`nextSiblings(element)`**: Retrieves all next siblings of an element. - **`observe(element, eventName, handler)`**: Attaches an event handler to an element. - **`positionedOffset(element)`**: Computes the positioned offset of an element. - **`previous(element[, cssRule][, index=0])`**: Selects the previous sibling element based on a CSS selector and an optional index. - **`previousSiblings(element)`**: Retrieves all previous siblings of an element. - **`readAttribute(element, attribute)`**: Reads the value of an attribute on an element. - **`recursivelyCollect(element, property)`**: Recursively collects values of a property from an element and its descendants. - **`relativize(element)`**: Converts the positioning of an element to relative. - **`remove(element)`**: Removes an element from the document. - **`removeClassName(element, className)`**: Removes a CSS class from an element. - **`replace(element[, html])`**: Replaces an element with HTML content. - **`scrollTo(element)`**: Scrolls the document so that an element is visible. - **`select(element, selector)`**: Selects elements based on a CSS selector. - **`setOpacity(element, opacity)`**: Sets the opacity of an element.
- 粉丝: 0
- 资源: 6
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
评论0