- 浏览: 2650060 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
80后的童年2:
深入浅出MongoDB应用实战开发网盘地址:https://p ...
MongoDB入门教程 -
shliujing:
楼主在不是精通java和php的前提下,请不要妄下结论。
PHP、CakePHP哪凉快哪呆着去 -
安静听歌:
希望可以一给一点点注释
MySQL存储过程之代码块、条件控制、迭代 -
qq287767957:
PHP是全宇宙最强的语言!
PHP、CakePHP哪凉快哪呆着去 -
rryymmoK:
深入浅出MongoDB应用实战开发百度网盘下载:链接:http ...
MongoDB入门教程
Part I: http://thinkweb2.com/projects/prototype-checklist/
1,错:
对:
2,错:
对:
3,错:
对:
4,错:
对:
5,错:
对:
6,错:
对:
7,错:
对:
8,错:
对:
9,错:
对:
10,错:
对:
11,错:
对:
Part II: http://thinkweb2.com/projects/prototype/?p=3
1,轻松监听键盘事件
2,不需要事件capturing
3,聪明的insert()
4,Form提交
Enjoy prototyping!
1,错:
document.getElementById('foo')
对:
$('foo')
2,错:
var woot = document.getElementById('bar').value var woot = $('bar').value
对:
var woot = $F('bar')
3,错:
$('footer').style.height = '100px'; $('footer').style.background = '#ffc';
对:
$('footer').setStyle({ height: '100px', background: '#ffc' })
4,错:
$('coolestWidgetEver').innerHTML = 'some nifty content'
对:
$('coolestWidgetEver').update('some nifty content') $('coolestWidgetEver').update('some nifty content').addClassName('highlight').next().hide()
5,错:
new Ajax.Request('ninja.php?weapon1=foo&weapon2=bar')
对:
new Ajax.Request('ninja.php', { parameters: { weapon1: 'foo', weapon2: 'bar' } })
6,错:
new Ajax.Request('blah.php', { method: 'POST', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', })
对:
new Ajax.Request('blah.php')
7,错:
Event.observe('myContainer', 'click', doSomeMagic)
对:
$('myContainer').observe('click', doSomeMagic)
8,错:
$$('div.hidden').each(function(el) { el.show(); })
对:
$$('div.hidden').invoke('show')
9,错:
$$('div.collapsed').each(function(el) { el.observe('click', expand); })
对:
$$('div.collapsed').invoke('observe', 'click', expand)
10,错:
$$('input.date').invoke('observe', 'focus', onFocus); $$('input.date').invoke('observe', 'blur', onBlur);
对:
$$('input.date') .invoke('observe', 'focus', onFocus) .invoke('observe', 'blur', onBlur)
11,错:
$('productTable').innerHTMl = $('productTable').innerHTML + '<tr><td>' + productId + ' ' + productName + '</td></tr><tr><td>' + productId + ' ' + productPrice + '</td></tr>'
对:
var rowTemplate = new Template('<tr><td>#{id} #{name</td></tr><tr><td>#{id} #{price}</td></tr>'); $('productTable').insert( rowTemplate.evaluate({ id: productId, name: productName, price: productPrice })) )
Part II: http://thinkweb2.com/projects/prototype/?p=3
1,轻松监听键盘事件
$('myInput').observe('keyup', function(e) { if (e.keyCode == Event.KEY_TAB) doSomethingCoolWhenTabIsPressed(); })
2,不需要事件capturing
$('productInfo').observe('click', displayProductInfo, false); // 'false' could be skipped $('productInfo').observe('click', displayProductInfo);
3,聪明的insert()
new Insertion.Bottom('blogEntry', new Template('<div><h2>#{name}</h2><p>#{content}</p></div>') .evaluate({ name: blogEntry.name, content: blogEntry.content }) ); // Insertion class is deprecated - it's recommended to use Element's insert method: $('blogEntry').insert(new Template('<div><h2>#{name}</h2><p>#{content}</p></div>') .evaluate({ name: blogEntry.name, content: blogEntry.content }), 'bottom'); // 'bottom' can be skipped $('blogEntry').insert(new Template('<div><h2>#{name}</h2><p>#{content}</p></div>') .evaluate{( name: blogEntry.name, content: blogEntry.content }));
4,Form提交
$('register').observe('submit', function(e) { Event.stop(e); $(this).request(); }) $('register').observe('submit', function(e) { Event.stop(e); new Ajax.Request($(this).readAttribute('action', { parameters: Form.serializeElements($(this).getInputs('', 'email')) }) }) $('register').observe('submit', function(e) { Event.stop(e); new Ajax.Request(this.readAttribute('action'), { parameters: Form.serializeElements($(this).getElements() .reject(function(el) {return el.hasAtrribute('multiple')}) ); }) }) $('register').observe('submit', function(e) { Event.stop(e); new Ajax.Request($(this).readAttribute('action', { parameters: Form.serializeElements($$('#register input:not([multiple])')) }) })
Enjoy prototyping!
发表评论
-
Ext源码解析:3, DomHelper.js
2008-07-15 16:45 2375from http://www.beyondrails.com ... -
Ext源码解析:2, DomQuery.js
2008-07-11 10:54 2546fromhttp://www.beyondrails.com/ ... -
Ext源码解析:1, Ext.js
2008-07-09 18:08 2887来自http://www.beyondrails.com/bl ... -
Extjs Introduction
2008-07-08 02:04 8768from http://hideto.beyondrails. ... -
模拟Ajax提交上传文件
2008-06-04 00:24 4184XMLHTTP不支持文件上传这种form提交,但是我们可以模拟 ... -
escape JavaScript
2008-03-27 16:55 2600单引号、双引号、<script></scri ... -
Multiple IE
2007-11-22 10:35 2499老问题,js和css对跨浏览器兼容问题 在一台电脑上共存IE3 ... -
编辑表单后离开本页面时做提示(jQuery版)
2007-11-15 15:21 4987添加如下JavaScript: $.fn.enable_c ... -
十大Web应用漏洞清单,XSS排名第一
2007-10-22 12:36 3050owasp.org列出十大Web应用漏洞清单: 1, Cros ... -
IE下不能disabled掉select标签的option的解决方案
2007-10-11 17:48 8969原文:Select, Option, Disabled And ... -
Jester: JavaScript Client for REST
2007-09-04 13:51 2680Jester: JavaScriptian REST介绍了Je ... -
ASCB阅读笔记五、Arrays
2007-08-23 10:47 1788var array:Array = new Array() ... -
ASCB阅读笔记四、Numbers and Math
2007-08-15 12:08 1951显示最近的整数(四舍五入) Math.round(204.49 ... -
ASCB阅读笔记三、Runtime Environment
2007-08-10 23:34 24801,检测用户浏览器安装的Flash Player版本 http ... -
ASCB阅读笔记二、Custom Classes
2007-08-09 10:54 13411,ActionScript 3.0已经完全OO,所有AS代码 ... -
ASCB阅读笔记一、ActionScript Basics
2007-08-07 23:29 20091,使用trace来debug程序 package { ... -
method_missing in ActionScript 3/Flex
2007-08-07 18:05 1954method_missing in ActionScript ... -
Hilog 0.1 released.
2007-08-07 00:52 2050Hilog 0.1 release is a demo of ... -
在客户端保存状态
2007-08-05 18:13 3708Keeping State on the Client 在第 ... -
介绍Cairngorm
2007-08-05 15:36 19680Cairngorm是Adobe Labs上的Flex MVC框 ...
相关推荐
使用prototype操作ajax的例子. 附带prototype.js库
prototype1.6.0prototype1.6.0prototype1.6.0prototype1.6.0
prototype介绍和使用方法prototype介绍和使用方法prototype介绍和使用方法prototype介绍和使用方法
prototype的使用
例解Prototype框架.doc 第21章__使用Prototype框架.pdf Prototype源码注释版.pdf proprototype源码分析.doc totype_1.3_源码解读.txt
Prototype1.5.1使用手册(.chm格式) Prototype 使用 说明 手册
开源JS包Prototype使用指南开源JS包Prototype使用指南开源JS包Prototype使用指南开源JS包Prototype使用指南开源JS包Prototype使用指南
prototype.js文件使用和讲解prototype.js文件使用和讲解prototype.js文件使用和讲解prototype.js文件使用和讲解
利用DREAMWEVER开发网站的插件Prototype。
欢迎使用 Prototype API 参考手册。在左侧的区域中列出了主要的目录,当你点击其中任一目录时, 详细的内容将显示在右方区域中。 我们尽力为你提供最新的、叙述清楚的、样例丰富的文档,最终的目标是:在你阅读这...
prototype和script.aculo.us的文档,相当经典
Prototype1.6中文手册欢迎使用 Prototype API 参考手册。在左侧的区域中列出了主要的目录,当你点击其中任一目录时, 详细的内容将显示在右方区域中。 我们尽力为你提供最新的、叙述清楚的、样例丰富的文档,最终...
对prototype的用法说明
prototype的JS文件prototype的JS文件prototype的JS文件prototype的JS文件
这份 API 文档只是一份参考手册,如果你想要学习如何使用 Prototype,或者想熟悉 Prototype 的某些特性,请参考教程。 非常高兴能够制作这份文档! 关于这份文件 CHM 文件制作: Remigijus Jodelis. 最后更新...
BannerSlider 一个渣渣banner轮播的轮子使用prototype
Prototype Codes TextBook.rar:Prototype实战教程(爆爽,推荐); 2.Prototype API: Prototype1.5.1_API_CN_A.CHM:Prototype1.5.1中文API,版本一(推荐); prototype1.5.1_API_CN_B.CHM:Prototype1.5.1中文API,版本二...
prototype js脚本库prototype js脚本库prototype js脚本库prototype js脚本库
js的框架prototype.js 开放javascript的时候使用可以更方便,不必要去写那些繁琐的方法名
prototype1.5.1