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" )
相关文档:
1,用户名不能包含空格,第一个字母不能为数字,长度控制
2,密码和验证码要相同,不能为空,等等,一些很基本的功能,但是确实挺烦人的。
javascript调试起来确实比较麻烦。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<T ......
注意:Option中的O是要大写的,不然语法报错
1.动态创建select
function createSelect(){
var mySelect = document.createElement("select");
mySelect.id = "mySelect";
  ......
理解Javascript闭包(closure)
专题 原帖 http://www.w3cgroup.com/article.asp?id=87
此文用通俗的文字介绍了Javascript闭包 。
看过后,我对javascript闭包简单的理解就是 文中第四、五段中所说的“在内存中维持一个变量,不会被GC回收”。
当然还需要学习才能深入的理解javascript闭包
一、什么是闭包?
......
在JavaScript中没有多维数组的概念
但是可以模拟实现
1维
//1 不能确定数组length的情况下,先声明一个数组名,然后再逐个赋值。
var tArray=new Array();
tArray[0]='A';
tArray[1]='2';
//2 知道确切的length,创建数组
var tArray=new Array(10);
//3 创建数组的同时并赋值
var tArray=new Array('A','2','3', ......
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)> <td>no </table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="re ......