js学习
文章平均质量分 75
ellen_2011
这个作者很懒,什么都没留下…
展开
-
js 正则表达式
g是全局标志。如果设置了这个标志,对某个文本执行搜索和替换操作时,将对文本中所有匹配的部分起作用。如果不设置这个标志,则仅搜索和替换最早匹配的内容。m是多行标志。如果不设置这个标志,那么元字符“^”只与整个被搜索字符串的开始位置相匹配,而元字符“$”只与被搜索字符串的结束位置相匹配。如果设置了这个标志,“^”还可以与被搜索字符串中的“\n”或“\r”之后的位置(即下一行的行首)相匹配,而“$”还可...原创 2009-09-15 10:04:53 · 75 阅读 · 0 评论 -
7.1. Creating Objects 创建对象
Objects are composite datatypes: they aggregate multiple values into a single unit and allow you to store and retrieve those values by name. Another way to explain this is to say that an object is an ...原创 2009-07-04 00:19:43 · 86 阅读 · 0 评论 -
7.4 通用的对象的属性和方法(Universal Object Properties and Metho)
As discussed earlier, all objects in JavaScript inherit from the Object class. javaScript中的所有对象都是从类Object中继承而来的。 While more specialized categories of objects, such as those created with the Date...原创 2009-01-09 16:09:35 · 125 阅读 · 0 评论 -
7.3 作为关联数组的对象(Objects as Associative Arrays)
You've seen the . operator used to access the properties of an object. It is also possible to use the [] operator, which is more commonly used with arrays, to access these properties. Thus, the foll...原创 2009-01-09 14:28:26 · 147 阅读 · 0 评论 -
7.2 对象的属性(Object Properties )
可以通过 . 操作符来存取对象的属性值。 . 操作符左边的值必须为对象,通常它会是包含对象引用的一个变量的名字,也可以是任何返回一个对象的javascript 的表达式。 . 操作符右边的值必须为一个标识符,不能是字符串或一个表达式。 Object properties work like variables: you can store values in them and read val...原创 2009-01-09 13:53:37 · 401 阅读 · 0 评论 -
js 创建对象1
创建对象 1.对象直接量(最简单的创建对象的方式) The easiest way to create an object is to include an object literal in your JavaScript code. An object literal is a comma-separated list of property name/value pairs, encl...原创 2009-01-09 11:39:21 · 70 阅读 · 0 评论 -
with 语句
with 语句: with语句用于临时改变作用域链,语法如下: with (object) statement 这一语句非常有效的将object添加到作用域链的头部,执行完statement,作用域链又恢复到初始状态。 在实际中,使用with语句可以减少很多的输入。 举例: frames[1].document.forms[0].address.value; 使用with语句如下: wit...原创 2009-01-09 11:00:57 · 117 阅读 · 0 评论 -
js 异常处理
throw: 语法:throw expression; expression may evaluate to a value of any type. (expression 的值可以是任何类型的) Commonly, however, it is an Error object or an instance of one of the subclasses of Error. It...原创 2009-01-08 21:52:09 · 139 阅读 · 0 评论 -
js statement2(js语句)
function 语句 A function definition creates a new function object and stores that object in a newly created property named funcname.(翻译:函数定义创建了一个新的function对象,并且把这个对象储存在一个新创建的名为funcname 的属性中) Functi...原创 2009-01-08 21:06:27 · 101 阅读 · 0 评论 -
js statement(js 语句)
switch 语句 switch(typeof x) { case 'number': // Convert the number to a hexadecimal integer return x.toString(16); case 'string': // Return the string enclosed ...原创 2009-01-07 14:57:16 · 365 阅读 · 0 评论 -
js 个别操作符
in 操作符: The in operator expects a left-side operand that is or can be converted to a string(或可以被转换为字符串). It expects a right-side operand that is an object (or array)(对象或数组). It evaluates to TRue i...原创 2009-01-07 10:38:38 · 78 阅读 · 0 评论 -
类型转换
● 数值类型转换为字符类型的3种方式。 1. var n = 100; var n_as_string1 = n + ""; 2. var n_as_string2 = String(n); //不常用 3. var n_as_string3 = n.toString(); //也不常用 toFixed( )和toExpone...原创 2009-01-07 09:59:25 · 78 阅读 · 0 评论 -
JS的寻址、闭包、对象模型和相关问题
一:JS是静态作用域的 (《javaScript权威指南》指出:JavaScript中的函数运行在它们被定义的作用域里,而不是它们被执行的作用域里) JS的作用域是静态的,当定义一个function时,function的作用域是定义function时所在的作用域,而不是调用function时所在的作用域。 当调用一个function时,就会创建一个新的作用域,在这个作用域中用var定义的变量...原创 2009-07-23 14:18:40 · 146 阅读 · 0 评论