主流浏览器
IE6.0还支持一级DOM事件模型和Internet Explorer增强事件模型,部分支持W3C的二级DOM事件模型.
关于事件模型
IE7.0浏览器支持JScript5.7,该版本在JScript基础上有所增强,但与ECMA v3标准仍热是基本一致
在数据交互方面,JScript+ 5+支持 MSXML 4.0 组件,在外部接口方面,JScript5+完全兼容COM+/DCOM标准
原始调试方法-----利用输出语句,"反射"机制和调试对象来进行调试
在编写代码中遇到的问题,最原始的调试方法在程序中直接插入调试逻辑和输出语句.
定位代码和调用堆栈:一款适合的调试工具可以帮助你迅速定位错误代码和切入调用队堆栈.让工具帮你纠错,这样你就能够把更多的精力投入到实际的设计和编码实现中. step by step在切入调试过程中,可以控制代码单步执行.调试过程中的切入点被称作为"断点",通常在程序中可以人为调试器设置若干个"断点",启动调试程序后,调试器便会按照次序依次切入这些断点进行调试. 异常处理机制:-----一个try/catch/finally模式的例子js的异常处理机制是非常标准的try/catch/finally模式.js是弱类型语言,不能通过声明catch的参数类型来捕获不同类型的异常.不过通过实例判断可以很容易地区分和处理不同的异常.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
你应该让你的js的格式和你网页的格式采用相同的格式.如果js选中gbk或者其他格式将有其他的错误产生. parseFloat 方法返回字符串转换得到的浮点数必选项numString参数是包含浮点数的字符串parseFloat()反悔的numString保存相同的数字表示
parseFloat("1.2abc"); //返回1.2parseFloat("abc"); //返回NaN可以用isNaN来检测NaN
运算符"/"对两个运算数进行代数除法操作.如果运算数是非数值,运算符"/"会将他们进行转换.
ECMAScripts users C-style comments for both single-line and block comments.
comments:注释,解释A single-line comments begins with two forward-slash characters,such as this:// this is itforward-slash 斜线A block comments begins with a forward slash and asterisk(*) and ends with the opposite(*),as in this example.
/* * This is a muli-line */Strict Mode 严格遵循标准模式specify: 指定;详细说明;列举;把...什么加入说明书
execute:执行,实行,处死 Even though a semicolon is not required at the end of statement,it is recommended to always include one.Including semicolons helps prevent errors of omission,such as not finishing what you were typing,all allows developers to compress ECMAScript code by removing extra white space.semicolon:分号
if()test
variables:变量ECMAScript variables are loosely typed,meaning that a variable can hold any type of data.Every variable is simply a named placeholder for a value. To define a varibale,use the var operator(note that var is a keyword) follow by the varibable name(an identifier,as described earlier),like this:var messageThis code defines a variable named message that can be used to hold any value.To define a varibale, use the var operator(note that var is a keyword) followed by the variable name(an identifier,as describute earlier),like this :
var messageHere, message is defined value of "hi".Doing this initialization doesn't mark the variable as beinga string tyepe;it is simply the assignment of a value of
var message = "hi";
message = 100; //legal, but no recommendedlegal 法律的,but no recommended 可以使用,但不是推荐的 The typeof the Operate Because ECMAScript is loosely typed,there needs to be a way to determime the data type of a given variables.The typeof provides that information.Using the typeof operation on a value returns one of the following strings."undefined" if the value if undefined.
"boolean" if the value is a Boolean"string" if the values is a string"number" is the values is number"object" is the value is object "function" if the value is a functionThe typeof operator is called like this.
var message = "some string"
alert(typeof(message))alert(typeof(message))alert(typeof(199))Be aware there are a few cases where typeof seemingly returns a confusing but technically correct value.Calling typeof null returns a value of "object", as the special value null is considered to be an empty object reference.
The Undefined Type:The Undefined type has only one value, which is the special value undefined.When a variable is declared using var but not initalized, it is assigned the value of undefined as follows.declare:公开的,公布宣布的
Note that a variable containing the value of undefined is a different from a variable that hasn't been defined at all.consider:考虑仔细,细想In this example, the first alert displays the variable message,which is "undefined".In the second alert,an undeclared variable called age is passed into the alert() function.but this isn't very useful and in fact throws an error strict mode.
operator:经营者,操作员,话务员,行家
When defining a variable that is meant to later hold on object,it is advisable to initalize the variable to null as opposed to anything else.That way, you can explictly check for the value to determine if the variable has been filled with an object reference at a later time,such as in this example.