javascript
QuLong
这个作者很懒,什么都没留下…
展开
-
Javascript 事件编程 (二)
Event Handlers and the this Keyword事件处理程序和this关键字[quote]When your event handler is invoked, it is invoked as a method of the element on which the event occurred, so the this keyword refers to th...原创 2009-09-18 21:28:42 · 132 阅读 · 0 评论 -
关于google.setOnLoadCallback()的一点研究
google.setOnLoadCallback()是google ajax api的重要方法。在最近一个项目里,用了google的ajax api。问题是,这个方法到底在什么时候才会调用?在google的文档里面:http://code.google.com/intl/zh-CN/apis/ajax/documentation/[quote]当载入文档时,google.s...原创 2010-01-12 10:01:59 · 310 阅读 · 0 评论 -
ScriptDoc的Notation规则
这个还是蛮重要的,以前就一直很羡慕Java有一套标准来着:转自:https://aptanastudio.tenderapp.com/faqs/using-code-assist/scriptdoc-tag-quick[quote]This page provides an at-a-glance reference for the tags for the Aptana Script...原创 2010-01-23 19:37:12 · 166 阅读 · 0 评论 -
JavaScript 在浏览器中的相关概念:执行环境、引入脚本、安全策略等
The Window as Global Execution Context窗口作为全局执行环境[quote]document property for the Document objecttwo self-referential properties, window and selfa location property that refers to the Locat...原创 2009-09-02 09:32:45 · 147 阅读 · 0 评论 -
JavaScript window下面的常用函数、属性
我们常用的一些函数都是全局对象window下面的。这里将其梳理一下:Timers计时器[quote]global functions setTimeout( ), clearTimeout( ), setInterval( ), and clearInterval( ). [/quote][quote]Although the preferred way to invo...原创 2009-09-02 10:30:44 · 220 阅读 · 0 评论 -
Javascript 窗口的几何关系和相关方法、属性
Window Geometry窗口几何关系[quote]Screen coordinates describe the position of a browser window on the desktop; they are measured relative to the upper-left corner of the desktop. [/quote]Screen坐标系...原创 2009-09-02 10:47:06 · 149 阅读 · 0 评论 -
Javascript 寻找文档元素
Finding Elements in a Document在文档中查找元素[quote]The document.documentElement property refers to the tag that serves as the root element of the document. the document.body property refers to th...原创 2009-09-02 16:51:13 · 511 阅读 · 0 评论 -
Javascript 操控选择文本
Querying Selected Text查询选择的文本[quote]This is an area where little standardization exists, but it is possible to query the selected text in all modern browsers.[/quote]在这个方面,没有什么标准存在;但还是有可能读取用...原创 2009-09-02 17:02:39 · 205 阅读 · 0 评论 -
Javascript IE4 DOM
很多IE独有的DOM特性是沿袭自IE4的,所以有必要看看IE4 DOM的特性,与W3C的DOM模型有所区别。[quote]IE 4 does not support childNodes[], but it provides a similar children[] array on its Document and HTMLElement objects.IE 4 does no...原创 2009-09-02 17:14:51 · 204 阅读 · 0 评论 -
Javascript DHTML动画
JS实现的动画效果多半是用timmer实现的某个属性不断改变的过程。以下这个写好的函数是十分强大的~摘自JSDG 5th ed。附上我的注释:[code="js"]/** * AnimateCSS.js: * This file defines a function named animateCSS(), which serves as a framework * for cr...原创 2009-09-03 13:00:07 · 158 阅读 · 0 评论 -
Javascript CSS编程 (二)Computed Styles、Class修改、操作样式表
Scripting Computed Styles计算样式[quote]the rules of all stylesheets are tested to see which apply to the element, and the styles of those applicable rules are combined with any inline styles for th...原创 2009-09-03 13:15:02 · 377 阅读 · 0 评论 -
Javascript CSS编程 (一)元素定位、透明、内联样式
Querying Element Position and Size查询元素坐标和大小[quote]the offsetLeft and offsetTop properties of an element return the X and Y coordinates of the element.the offsetWidth and offsetHeight propert...原创 2009-09-03 14:29:16 · 174 阅读 · 0 评论 -
Javascript 事件编程 (一)
Events and Event Handling事件和事件处理[quote]The original event model: all js-enabled browsersThe standard event model: all modern explorer except IEThe Internet Explorer event model: IEIn the...原创 2009-09-04 15:27:08 · 165 阅读 · 0 评论 -
JavaScript Namespace模拟
做JavaScript的大型项目比较痛苦,它没有namespace的概念,所有顶级变量都在global对象里面混杂起来。特别是现在比较流行模块式开发,问题就越来越糟糕了,做出来的东西可能会把别人现有工程给搞残废……哈哈看看老外是怎么解决这个问题的……[quote]If you want to write a module of JavaScript code that can be...原创 2009-07-15 18:53:51 · 169 阅读 · 0 评论 -
JavaScript Class模拟深入 - Duck Typing 和 Class相关的工具类
Duck Typing[quote]If it implements all the methods defined by a class, it is an instance of that class.Duck typing is particularly useful in conjunction with classes that "borrow" methods from o...原创 2009-07-15 17:16:34 · 222 阅读 · 0 评论 -
offsetParent, offsetTop, offsetLeft
DOM Level 2 HTML: Node > Element > HTMLElement这是一些DOM 2级属性,这些属性在Javascript Definitive Guide里面这样描述:The properties supported by all HTML tags are listed here. Other properties, specific to certain...2009-07-04 15:14:31 · 162 阅读 · 0 评论 -
Other Image Properties
来自Javascript Definitive Guide,了解标签的属性[quote]In addition to the onload event handler demonstrated in Example 22-4, the Image object supports two others. The onerror event handler is invoked when an...2009-07-04 15:39:27 · 152 阅读 · 0 评论 -
Javascript 变量相关基础
来自JSDG:[quote]The types can be divided into two groups: primitive types and reference types. Numbers, boolean values, and the null and undefined types are primitive.Objects, arrays, and fu...原创 2009-07-06 15:31:06 · 115 阅读 · 0 评论 -
ECMA 推出 JavaScript 5
转发自http://www.comsharp.com/GetKnowledge/zh-CN/It_News_K875.aspx ECMA 本周推出了 JavaScript 5(PDF),除了增强基础函数库之外,还引入了严格运行时模式(Strict Runtime Modes)以避免代码中的常见错误。ECMA ECMAScript 4 的努力曾以失败告终,ECMA 甚至没有发布 E...原创 2009-12-28 21:17:49 · 139 阅读 · 0 评论 -
Javascript 创建文档元素
以下代码来自 https://developer.mozilla.org/cn/%E4%BD%BF%E7%94%A8Javascript%E5%92%8CDOM_Interfaces%E6%9D%A5%E5%A4%84%E7%90%86HTML#page-tags[code="js"]var mybody=document.getElementsByTagName("body").item...原创 2009-07-13 20:51:05 · 269 阅读 · 0 评论 -
JavaScript 对象Object和数组Array
Object、Array是JS的引用型基本属性枚举Object中的属性:[code="js"]function DisplayPropertyNames(obj) { var names = ""; for(var name in obj) names += name + "\n"; alert(names);}[/code]检查对象中是否有某...原创 2009-07-13 21:35:37 · 155 阅读 · 0 评论 -
JavaScript 函数Function 基础
函数是JS的引用数据类型匿名函数[code="js"]function() { //Code here}[/code]给一个函数名[code="js"]function foo() { //code here}[/code]或者[code="js"]var foo = function() { //Code here}[/cod...原创 2009-07-14 14:47:14 · 111 阅读 · 0 评论 -
JavaScript Prototype基础
The prototype Property[quote]prototype property that refers to a predefined prototype object[/quote]Prototype属性是指一个早已确定的原型对象Classes, Constructors, and Prototypes[quote]JavaScript does not ...原创 2009-07-14 15:56:56 · 157 阅读 · 0 评论 -
JavaScript Class模拟基础
Simulating Classes in JavaScript目前,用js来模拟class是一件非常麻烦的事情,多少有点不优雅。但是未来的JS肯定会支持class,那么这个语言就是基于class和Prototype的混合继承?到时候会不会越来越混乱呢?笑……Instance Properties实例属性[quote]By default, any object p...原创 2009-07-14 16:39:48 · 136 阅读 · 0 评论 -
javascript this 关键字小提示
来自:http://www.macji.com/2009/01/18/javascript-this-keyword-tips/this指向当前作用域的对象,如果找不到,往上一层找,直到window。this 关键字很好用,很灵活,正因为很灵活,所以一不小心你就会掉进陷阱,所以你要注意以下几点: 1. 元素对象的this,始终指向该元素,如事件绑定。 2. 全局...原创 2009-07-14 22:01:05 · 107 阅读 · 0 评论 -
JavaScript Class模拟深入 - 继承、子类
Superclasses and Subclasses之前的一篇文章讲解的类都是直接继承自Object的,这里会介绍如何在JS中实现继承自任意“类”[quote]Java, C++, and other class-based object-oriented languages have an explicit concept of the class hierarchy. ...原创 2009-07-15 16:27:42 · 174 阅读 · 0 评论 -
JavaScript 判定对象类型
判定JS的对象类型基本是MISSION Impossible。JS的对象可能是JS核心对象、可能是自定义类、可能是空等等,但是其弱类型机制又无法有什么很准确的方法来判定这个对象到底是什么,特别是当这个东西是有继承的……[quote]typeof is useful primarily for distinguishing primitive types from objects. Th...原创 2009-07-15 16:53:07 · 144 阅读 · 0 评论 -
WebApp在移动端的涅盘- 另类的移动端应用程序开发
同时欢迎到我的BLOG讨论 : http://pagetalks.com/江湖有江湖的规矩,大家都知道iPhone上的Cocoa Touch框架和Xcode是开发Apple移动产品的王道。Android SDK和Eclipse是开发Android App的王道⋯⋯你可以找到所有主流平台的开发框架和相关IDE。你说这做移动端应用的人容易么?虽说Blackberry和Android都是基于...2010-09-27 22:35:43 · 188 阅读 · 0 评论