JavaScript
greybeard
这个作者很懒,什么都没留下…
展开
-
JavaScript ---- All Literals
12 // The number twelve1.2 // The number one point two"hello world" // A string of text'Hi' // Another stringt...原创 2011-12-30 10:43:26 · 107 阅读 · 0 评论 -
JS继承
1. 原型式继承 [code="java"] // 为Person对象创建一个构造函数 function Person(name) { this.name = name; } // 给Person对象添加一个新方法 Person.prototype.getName = function(){ return this...原创 2011-11-30 09:44:35 · 73 阅读 · 0 评论 -
JS重要的地方
在JavaScript里,作用域是由函数划分的,而不是由块(block)划分。基于浏览器的JavaScript的一个有趣的特性是,所有属于全局作用域的变量其实都是window对象的属性(property)。...原创 2011-11-30 09:14:15 · 73 阅读 · 0 评论 -
Chapter1 Introduction to JavaScript
1. JS is a high-level, dynamic, untyped interpreted programming language that is well-suited to object-oriented and functional programming styles.2. [code="java"] // variable is a s...原创 2011-11-24 11:37:04 · 97 阅读 · 0 评论 -
Preface
This book is divided into four parts. Part 1 covers the JavaScript language itself. Part 2 covers client-side JavaScript: the JavaScript APIs defined by HTML5 and related standards...原创 2011-11-24 09:48:52 · 58 阅读 · 0 评论 -
JS 对象
1. JavaScript的简单类型包括数字,字符串,布尔值(true和false),null值和 undefined值,其他所有的值都是对象。2. JS中的对象是无类别(class-free)的,它对新属性的名字和值没有约束。3. 一个对象字面量就是包围在一对花括号中的零或多个“名/值"对。4. 属性名可以是包括空字符串在内的任何字符串。5. 属性的值可以...原创 2011-11-23 17:53:34 · 62 阅读 · 0 评论 -
JavaScript 基础语法
1. JavaScript 只有一个单一的数字类型。它在内部被表示为64位的浮点数,和Java的 double一样。 不像大多数其他的编程语言,它没有分离除整数类型,所以1和1.0是相同的值。 值NaN是一个数值,它表示一个不能产生正常结果的运算结果,NaN不等于任何值,包括 它自己。可以用函数isNaN( number )检测NaN。 值In...原创 2011-11-19 11:25:49 · 61 阅读 · 0 评论 -
JavaScript ---- 示例(十进制转换为二进制)
[code="java"] 十进制转换为二进制 var input_digit = 0; var binary; function digit_to_binary() { input_digit = document.getElementById('input_digit')...原创 2012-01-17 23:15:54 · 170 阅读 · 0 评论 -
JavaScript ---- Type Conversions
JavaScript is very flexible about the types of values it requires.When JavaScript expects a boolean value, you may supply a value of any type, and JavaScript will convert it as needed.If JavaScrip...原创 2012-01-16 23:27:37 · 104 阅读 · 0 评论 -
JavaScript ---- Wrapper Objects
We've also seen that strings have properties and methods: var s = "hello world!"; // A string var word = s.substring(s.indexOf(" ")+1, s.lenght); // Use string propertiesString...原创 2012-01-14 23:41:44 · 91 阅读 · 0 评论 -
JavaScript ---- The Global Object
1. The global object is a regular JavaScript object that serves a very important purpose: the properties of this object are the globally defined symbols that are available to a JavaScript program.Wh...原创 2012-01-14 23:41:34 · 86 阅读 · 0 评论 -
JavaScript ---- null VS undefined
共同点:1, [color=red]null[/color] and [color=red]undefined[/color] both indicate an absence of value.2. Both are falsy values-----they behave like false when a boolean value is required.3. Neither ...原创 2012-01-14 23:41:23 · 59 阅读 · 0 评论 -
JavaScript-----需要留心之处
1. === [code="java"] if (o !== null) .... [/code] 逻辑运算符 [table] |运算符|运算符说明|示例|示例说明| |==|等于|x==y|如果x等于2, y等于2,则x==y| |===|全等于(值相等,数据类型也相等)|x===y|如果x等于整数2,y为字符串"2",则x===y不成立|...原创 2012-01-06 10:55:15 · 59 阅读 · 0 评论 -
JavaScript ---- Core constructor
1, Date var then = new Date(2010, 0, 1); var later = new Date(2010, 0, 1, 17, 10, 30); var now = new Date() later.getFullYear() later.getMonth() later.getDate() later.getDa...原创 2012-01-06 08:27:38 · 73 阅读 · 0 评论 -
JavaScript----数字, 字符串, 布尔类型
1. 数字类型(numbers) 1.1 javascript不区分整型和浮点型,所有呈现的都是浮点型,并且是64位的浮点型。 1.2 数字类型支持正常的+, -, *, /, %操作,并且可以通过Math对象实现复杂点的数学运算。 1.3 javascript不会抛出错误,当出现溢出和下溢和被0整除的情况。 1.4 示例: var n = 123...原创 2012-01-06 00:51:04 · 94 阅读 · 0 评论 -
JavaScript----变量
1. JavaScript变量是无类型的(untyped)2. 变量申明(var)3. 不是在函数内的变量,即为全局变量。原创 2012-01-06 00:21:54 · 63 阅读 · 0 评论 -
JavaScript ---- Types
1. JavaScript types can be divided into two categories: 1.1 primitive types 1.2 object types2. JavaScript's primitive types include: 2.1 numbers 2.2 strings of text (known ...原创 2012-01-05 16:14:29 · 81 阅读 · 0 评论 -
JS类似命名空间制作
[code="java"]// 创建一个默认的,全局的命名空间var YAHOO = {};// 使用对象设置一些子命名空间YAHOO.util = {};// 创建最终命名控件,它包含一个值为函数的属性YAHOO.util.Event = { addEventListener: function(){...}};// 调用某个具体命名空间中的...原创 2011-11-30 10:26:00 · 94 阅读 · 0 评论