7 JavaScript Differences Between Firefox & IE
Although the days of long and tedious code branches to target specific browsers in JavaScript are over, once in a while it's still necessary to do some simple code branching and object detection to ensure that a certain piece of code is working properly on a user's machine.
In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax. In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax.
1. The CSS “float” property 1. The CSS “float” property
The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example, to access the background-color property of a The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example, to access the background-color property of a
whose ID is “header”, we would use the following syntax: whose ID is “header”, we would use the following syntax:
document.getElementById( "header" ).style.backgroundColor= "#ccc" ; document.getElementById( "header" ).style.backgroundColor= "#ccc" ;
But since the word “float” is already reserved for use in JavaScript, we cannot access the “float” property using object.style.float . Here is how we do it in the two browsers: But since the word “float” is already reserved for use in JavaScript, we cannot access the “float” property using object.style.float . Here is how we do it in the two browsers:
The IE Syntax: The IE Syntax:
document.getElementById( "header" ).style.styleFloat = "left" ; document.getElementById( "header" )
相关文档:
<form name="form1">
<input type="file" name="file1" onchange="checkimage
(value)">
</form>
<script language="javasc ......
---->什么是类和对象
这是所有面向对象编程之前必须弄明白的.
所谓类:简单地说就是模板,说的专业一些,是一类具有某种性质的物的集合.比如:人就是一个类,车也是一个类,等等.
所谓对象:就是类的具体实现.如上面所说,人是一个类,一个具体的人就是一个对象,比如张三.
对象是类的实例化后的结果.ja ......
前几天在测试网站兼容性问题,发现原来在IE下面正常的显示时间在Firefox获取年份下显示109
&nb ......
1.<select></select>标签应用
通常的写法是:
<select onchange="javascript:windwo.open(this.options[this.selectedIndex].value)">
<option>MAIN</option>
& ......
理解Javascript闭包(closure)
专题 原帖 http://www.w3cgroup.com/article.asp?id=87
此文用通俗的文字介绍了Javascript闭包 。
看过后,我对javascript闭包简单的理解就是 文中第四、五段中所说的“在内存中维持一个变量,不会被GC回收”。
当然还需要学习才能深入的理解javascript闭包
一、什么是闭包?
......