Home  >  Article  >  Web Front-end  >  How to handle javascript variable scope in different browsers_javascript skills

How to handle javascript variable scope in different browsers_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:00:341007browse

1. About prototype: prototype here is a feature of javascript, not the famous prototype framework:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]


2. About Variable scope, and the different handling of js by IE and Firefox, here are a few examples, some of which are notes I saw from elsewhere, and some of which I dug out myself.
2.1

[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]


2.2 [Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]

2.3:
... Click me!

[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]

... Click me!


[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]

Click me!



[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]
Click me!




[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute 2.7
Click me!
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]

2.8 


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]


2.9 


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]


2.10 


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]


2.11


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

2.12


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

2.13


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

2.14:

注意这三个html文件的结果有什么不同.
a.html: 

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

b.html:

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

c.html:

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

2.15

看看IE,firefox下分别运行有何不同:


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn