prototype.js1.4版开发者手册(8)
作者:THIN 来源:cnblogs 发布时间:2007-09-30 14:09:00
标签:prototype,手册
对String的扩展
Method | Kind | Arguments | Description |
---|
stripTags() | instancee | (none) |
|
stripScripts() |
| (none) | 返回一个把所有的script都移除的字符串。 |
escapeHTML() | instance | (none) | 返回一个把所有的HTML标记合适的转义掉的字符串。 |
unescapeHTML() | instance | (none) | escapeHTML()的反转。 |
extractScripts() | instance | (none) | 返回一个包含在string中找到的所有<script>的数组。 |
evalScripts() | instance | (none) | 执行在string中找到的所有<script>。 |
toQueryParams() | instance | (none) | 把querystring分割才一个用parameter name做index的联合Array,更像一个hash。 |
parseQuery() | instancee | (none) | 和toQueryParams()一样.. |
toArray() | instance | (none) | 把字符串转换成字符数组. |
camelize() | instance | (none) | 转换一个以连字符连接的字符串成一个骆驼法样式的字符串。比如,这个函数在写代码时,把它做为一个样式工具使用是很有用的。 |
对 Array的扩展
因为array扩展于enumerable,所以所有enumberable对象的函数,array都是可以使用的,除此之外,下面的这些也是已经实现了的。
Method | Kind | Arguments | Description |
---|
clear() |
| (none) | 清空。 |
compact() | instance | (none) | 返回一个不包括源array中null或undefined元素的array,此方法不改变源array。 |
first() | instance | (none) | 返回array的第一个对象。 |
flatten() | instance | (none) | 通过递归组合array每个元素的子元素(如果该元素也是array)来返回一个“扁平的”一维的array。 |
indexOf(value) | instance | value: what you are looking for. | 返回给出数字位置(从0算起)的元素,如果在该位置没有找到对象,返回-1。 |
inspect() | instance | (none) | 重载inspect(),返回更好格式的反映Array每个元素的字符描述。 |
last() | instance | (none) | 返回最后一个元素。 |
reverse([applyToSelf]) | instance | applyToSelf: indicates if the array itself should also be reversed. | 反转Array中元素的顺序,如果没有给出参数,或参数为true,则源Array中元素的顺序也反转,否则源Array保持不变。 |
shift() | instance | (none) | 返回Array的第一个元素并从Array中移除它,Array的Length-1。 |
without(value1 [, value2 [, .. valueN]]) | instance | value1 ... valueN: values to be excluded if present in the array. | 返回一个把参数列表中包含的元素从源Array中排除的Array。 |
document DOM扩展
Method | Kind | Arguments | Description |
---|
getElementsByClassName(className [, parentElement]) |
| className: name of a CSS class associated with the elements, parentElement: object or id of the element that contains the elements being retrieved. | 返回所有CSS className属性等于className参数的元素,如果没有给出parentElement,那么将搜索document body。(此处使用document.body我觉得不如使用document,因为有时有的页面没有body) |
Event扩展
Property | Type | Description |
---|
KEY_BACKSPACE | Number | 8: Constant. Code for the Backspace key. |
KEY_TAB | Number | 9: Constant. Code for the Tab key. |
KEY_RETURN | Number | 13: Constant. Code for the Return key. |
KEY_ESC | Number | 27: Constant. Code for the Esc key. |
KEY_LEFT | Number | 37: Constant. Code for the Left arrow key. |
KEY_UP | Number | 38: Constant. Code for the Up arrow key. |
KEY_RIGHT | Number | 39: Constant. Code for the Right arrow key. |
KEY_DOWN | Number | 40: Constant. Code for the Down arrow key. |
KEY_DELETE | Number | 46: Constant. Code for the Delete key. |
observers: | Array | List of cached observers. Part of the internal implementation details of the object. |
Method | Kind | Arguments | Description |
---|
element(event) | static | event: an Event object | 返回事件源对象。 |
isLeftClick(event) | static | event: an Event object | 如果点击了鼠标左键,返回true. |
pointerX(event) | static | event: an Event object | 返回鼠标的X座标。 |
pointerY(event) | static | event: an Event object | 返回鼠标的Y座标。 |
stop(event) | static | event: an Event object | 使用此函数来中断事件的默认行为并阻止传递(冒泡)。 |
findElement(event, tagName) | static | event: an Event object, tagName: name of the desired tag. | 从事件源对象开始向上搜索DOM树,直到找到第一个符合tagName的元素 |
observe(element, name, observer, useCapture) | static | element: object or id, name: event name (like ’click’, ’load’, etc), observer: function to handle the event, useCapture: if true, handles the event in the capture phase and if false in the bubbling phase. | 为对象的某个事件增加一个处理函数。 |
stopObserving(element, name, observer, useCapture) | static | element: object or id, name: event name (like ’click’), observer: function that is handling the event, useCapture: if true handles the event in the capture phase and if false in the bubbling phase. | 和上面的函数相反。 |
_observeAndCache(element, name, observer, useCapture) | static | | 私有函数,别管它。 |
unloadCache() |
| (none) | 私有函数,别管它。从内存中清除所有的observers缓存。 |
猜你喜欢
SMTP模块这么多已定义的类中,我们最常用的的还是smtplib.SMTP类,就具体看看该类的用法:smtp实例封装一个smtp连接,它支持
如何快速的复制一张表首先创建一张表db1.t,并且插入1000行数据,同时创建一个相同结构的表db2.t假设,现在需要把db1.t里面的a&
属性(attribute):R中对象具备的特性特性描述了所代表的内容以及R解释该对象的方式很多时候两个对象之间的唯一差别在于它们的属性不同常
一、设置SQLServer身份验证1、按下windows+R,弹出运行框。2、在弹出框中输入cmd,按下enter键。3、在dos命令窗口输
闭包基本介绍闭包就是 一个函数 和其相关的 引用环境 组合的一个整体好处: 保存引用的变量
一:什么是数据库,为什么要有数据库?数据,数据库,数据库管理系统和数据库系统是与数据库技术密切相关的四个基本概念。数据库相信大家都耳熟能详了
一、MySQL Server层日志简介一个mysql client发起一个连接请求,处理请求的过程如下图所示:MySQL日志是在MySQL
代码中用到了nextpow2,其中n = nextpow2(x) 表示最接近x的2的n次幂。#!/usr/bin/env pythonimp
此文译自Fred Wilson 2010年2月在迈阿密举行的Web未来应用的年会上的演讲谢谢青云推荐了这篇这么好的演说谢谢卓和百忙中抽空帮我
以下是引用片段: ImportsSystem.Data ImportsSystem.Data.SqlClient PublicClassFo
1、shutdown normal 正常方式关闭数据库。 2、shutdown imme
1、首先在本机安装ssh在cmd输入ssh,出现下面信息代表安装成功2、vscode安装 Remote - SSH 插件3、连接远程主机vs
概述通过自定义网络, 我们可以自己创建网络并和现有的网络串联起来, 从而实现各种各样的网络结构.SequentialSequential 是
什么是组播点对点连接可以处理很多通信需求,不过随着直接连接数的增加,在多对通信方之间传递相同的消息会变得越来越困难。单独地向各个接收方发送消
java连接数据库增、删、改、查工具类数据库操作工具类,因为各厂家数据库的分页条件不同,目前支持Mysql、Oracle、Postgresq
教程使用的版本是2019.1新版本安装激活可以参考此篇教程,通用版!一、go安装1、建议去go语言中文网下载,网址:https://stud
前言在Django使用Celery异步发送邮件的过程中,遇到Celery日志提示任务已接收,但实际上任务并没有执行,解决后特此记录。使用版本
本文实例讲述了python采用getopt解析命令行输入参数的方法,分享给大家供大家参考。具体实例代码如下:import getopt im
PHP mysqli_rollback() 函数关闭自动提交,做一些查询,提交查询,然后回滚当前事务:<?php// 假定数据库用户名
这篇文章主要介绍了如何使用Python发送HTML格式的邮件,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需