易截截图软件、单文件、免安装、纯绿色、仅160KB

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" )


相关文档:

JavaScript中的剪贴板(clipboardData)

JavaScript中的剪贴板(clipboardData)
clipboardData 对象
提供了对剪贴板的访问。
三个方法
1.clearData(sDataFormat) 删除剪贴板中指定格式的数据。
2.getData(sDataFormat) 从剪贴板获取指定格式的数据。
3.setData(sDataFormat, sData) 给剪贴板赋予指定格式的数据。返回 true 表示操作成功。
例子
<script ......

IE与Firefox下javascript getyear年份的兼容性写法

                    前几天在测试网站兼容性问题,发现原来在IE下面正常的显示时间在Firefox获取年份下显示109
                &nb ......

Javascript操作Select和Option

注意:Option中的O是要大写的,不然语法报错
1.动态创建select
      function createSelect(){
var mySelect = document.createElement("select");
          mySelect.id = "mySelect"; 
        ......

写的第一个较有意义Javascript程序

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javascript</t ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号