Prototypes.js 使用
来源:互联网 发布:guts and glory mac 编辑:程序博客网 时间:2024/05/20 05:58
【1】使用$方法代替 document.getElementById
•var divElement = $(‘id); //返回id为”id”的元素对象
【2】使用$$方法获得元素引用
•$$方法同样用于获得元素的引用,与$不同的是,它接受一个css选择器作为参数,将所有符合该选择器的元素作为数组返回。
【3】根据css类名取得元素集合
【4】使用Try.these尝试运行多个函数
•Try.these(func1[,func2[,func3…]]);
【5】使用$F方法来获得表单元素的值
【6】数组迭代的简化方法
【7】设置元素的样式•array.each(function(arrayItem,arrayIndex)•{•//dosomething..•});
【8】切换元素的隐现状态•var div = $(“divId”);•div.setStyle({•cssFloat:”left”,•opacity:0.5•});
【9】序列化表单值•通过$方法获得的元素,可以使用hide方法来隐藏该元素,也可以使用show方法来显示隐藏的元素,还可以使用toggle方法来切换当前元素的隐现状态。
•使用$方法获取的表单元素,Prototype.js会对其扩展,增加serialize方法来完成对其表单项的序列化输出。
【10】转换HTML标签
【12】使用Class.create()创建类
【11】基于Prototype.js的类和继承•Prototype.js对String对象进行了扩展,并提供了escapeHTML方法来完成之一工作,其语法如下所示。
•var str = htmlstring.escapeHTML();
【12】使用Class.create()创建类
【13】Prototype.js中的继承•var class = Class.create();
【14】Prototype.js中的事件处理•Prototype.js提供了Object.extend方法来复制对象的属性和方法。
【15】Prototype.js的Ajax功能
注册事件处理函数•Prototype.js提供了Event.observe来注册事件处理函数,其语法如下所示。注销事件处理函数•Event.observe(element, eventName, handler[, useCapture = false])•使用Event.stopObserving方法可以注销一个事件处理函数,其语法如下所示。•Event.stopObserving(element, eventName, handler[, useCapture = false])
Ajax.Request方法详解•newAjax.Request(url[,options]);•newAjax.Updater(container, url[, options]);
•newAjax.PeriodicalUpdater(container, url[, options]);
- Prototypes.js 使用
- 深入理解 prototypes.js
- Tableview中Dynamic Prototypes动态表的使用
- Prototypes analyze
- Note On <You Don't Know JS - this and Object Prototypes>
- JavaScript: Classes and Prototypes
- JavaScript Object Prototypes
- Function,Object,Prototypes,__proto__
- JavaScript Object Prototypes
- nyoj 1278 Prototypes analyze
- G Prototypes analyze
- Chapter9 Classes,Constructor, and Prototypes - - - Prototypes and Inheritance
- Prototypes and Inheritance in JavaScript
- Understanding “Prototypes” in JavaScript【转】
- Prototypes and Inheritance in JavaScript
- Javascript 原型和继承(Prototypes and Inheritance)
- Javascript 原型和继承(Prototypes and Inheritance)
- Document Object Model Prototypes, Part 1: Introduction
- Ogre源码分析与学习笔记-2 纹理
- Linux中/proc目录下文件详解
- 苹果 ios----把NSDate只精确到天
- HDU3905 DP
- TCP/IP三次握手详解
- Prototypes.js 使用
- 或的解决方案
- 介绍两种常用的Ftp客户端如何显示.htaccess等隐藏文件
- 支持向量机简介
- 天气 插件 地址
- 让线程飞
- 分布式数据库的优越性
- sed
- debug心得--关于引用