Summary of JS IE and FF compatibility issues_javascript skills
Existing problem:
There are many statements like document.formName.item("itemName") in the existing code, which cannot be run under MF
Solution:
Use document.formName.elements["elementName"] instead
Others
See 2
2. Collection class object issues
Existing issues :
Many collection class objects in the existing code use () when accessing them. IE can accept it, but MF cannot.
Solution:
Use [] instead as subscript operation. For example: document.forms("formName") is changed to document.forms["formName"].
Another example: document.getElementsByName("inputName")(1) changed to document.getElementsByName("inputName")[1]
3. window.event
Existing issues :
Using window.event cannot be run on MF
Solution:
MF's event can only be used at the scene where the event occurs, and this problem cannot be solved yet. It can be modified like this:
Original code (can run in IE):
...
New code (can run in IE and MF):
...
In addition, if the first line of the new code does not change and is the same as the old code (that is, the gotoSubmit call does not give parameters), it will still only Can run in IE, but no errors. Therefore, the tpl part of this solution is still compatible with the old code.
4. The problem of using the id of an HTML object as an object name
Existing problems:
In IE, the ID of an HTML object can be used directly as the variable name of a subordinate object of document. Not in MF.
Solution: Use getElementById("idName") instead of idName as an object variable.
5. Problems with using idName string to obtain objects
Existing problems:
In IE, you can use eval(idName) to obtain the HTML object with the id of idName. In MF cannot.
Solution: Use getElementById(idName) instead of eval(idName).
6. The problem that the variable name is the same as an HTML object id
Existing problems:
In MF, because the object id is not used as the name of the HTML object, it can be used with HTML Variable names with the same object id cannot be used in IE.
Solution:
When declaring variables, always add var to avoid ambiguity, so that they can run normally in IE.
In addition, it is best not to take the same variable name as the HTML object id to reduce errors.
Others: See question 4
7. Event.x and event.y issues
Existing issues:
In IE, the event object has x, y Attribute, not available in MF.
Solution:
In MF, the equivalent of event.x is event.pageX. But event.pageX is not available in IE.
So event.clientX is used instead of event.x. This variable also exists in IE.
Event.clientX and event.pageX have subtle differences (when the entire page has scroll bars), but most of the time they are equivalent.
If you want to be exactly the same, you can have a little more trouble:
mX = event.x ? event.x : event.pageX;
Then use mX instead of event.x
Others: event. layerX is available in both IE and MF. Whether there is any specific difference has not yet been tested.
8. About frame
Existing problems:
You can use window.testFrame to get the frame in IE, but not in mf
Solution:
In frame The main difference between mf and ie in terms of usage is: If the following attributes are written in the frame tag:
Then ie can access the window object corresponding to this frame through id or name
And mf can only access the window object corresponding to this frame through name
For example, if the above frame tag is written in the htm inside the top window, then you can access it like this
ie: window.top.frameId or window .top.frameName to access this window object
mf: Only window.top.frameName can be used to access this window object
In addition, window.top.document.getElementById("frameId" can be used in both mf and ie ") to access the frame tag
and you can use window.top.document.getElementById("testFrame").src = 'xx.htm' to switch the content of the frame
or you can use window.top.frameName. location = 'xx.htm' to switch the content of the frame
For a description of frame and window, please refer to the 'window and frame' article of bbs
and the test under the /test/js/test_frame/ directory - ---adun 2004.12.09 Modification
9. In mf, the attributes you define must be obtained by getAttribute()
10. There is no parentElement parement.children in mf but use parentNode parentNode. childNodes
The meaning of the subscript of childNodes is different in IE and MF. MF uses DOM specification, and blank text nodes will be inserted into childNodes.
Generally, this problem can be avoided through node.getElementsByTagName().
MF의 input.parentNode 값은 form인 반면, IE의 input.parentNode 값은 빈 노드입니다.
MF의 노드에는 RemoveNode 메서드를 사용해야 합니다. 다음 방법 node.parentNode.removeChild( node)
11.const 문제
기존 문제:
IE에서는 const 키워드를 사용할 수 없습니다. const constVar = 32; 이는 IE의 구문 오류입니다.
해결책:
const를 사용하지 말고 대신 var를 사용하세요.
12. Body 개체
브라우저에서 body 태그를 완전히 읽기 전에 MF의 본문이 존재하는 반면, IE는 본문을 완전히 읽은 후에 존재해야 합니다.
13 . URL을 js로 작성하고 직접 작성하지 마세요. 예를 들어 var url = 'xx.jsp?objectName=xx&objectEvent=xxx'
frm.action = url이면 다음과 같습니다. 그로 인해 url이 정상적으로 표시되지 않게 됩니다.
일반적으로 서버에서는 해당 매개변수를 찾을 수 없다는 오류를 보고하게 됩니다
물론, 그런 경우는 예외입니다. tpl에서는 tpl이 xml 사양을 준수하고 &를 &로 작성해야 하기 때문입니다.
일반 MF는
14에서 js &를 인식할 수 없습니다. nodeName 및 tagName 문제
기존 문제:
MF에서는 모든 노드에 nodeName 값이 있지만 textNode에는 tagName 값이 없습니다. IE에서는 nodeName
사용에 문제가 있는 것 같습니다. (구체적인 상황은 테스트해보진 않았지만 IE가 여러번 죽었습니다.)
해결 방법:
tagName을 사용하되 비어 있는지 감지해야 합니다.
15. 요소 속성
input.type 속성은 IE에서는 읽기 전용이지만 MF
16에서는 수정할 수 있습니다. .all[name ] 문제
기존 문제:
IE에서는 getElementsByName()이나 document.all[name]을 사용하여 div 요소를 얻을 수 없습니다(다른 요소가 있는지는 모르겠습니다). 얻을 수 없는 것).
17. DOM 데이터 섬 문제
기존 문제:
IE에서
해결책:
IE의 데이터 바인딩 메커니즘은 JS로 시뮬레이션할 수 있지만 너무 번거롭기 때문에 데이터 바인딩 메커니즘을 사용하지 않는 것이 좋습니다. 이러한 종류의 시뮬레이션을 구현하는 라이브러리 MF에서는 알려진 HTML 태그와 XML 사양을 준수하는 기타 태그가 모두 통합 DOM 트리를 사용하여 처리됩니다. , 그러나 IE와의 작은 차이점은 IE에서는

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese

More and more users are starting to upgrade the win11 system. Since each user has different usage habits, many users are still using the ie11 browser. So what should I do if the win11 system cannot use the ie browser? Does windows11 still support ie11? Let’s take a look at the solution. Solution to the problem that win11 cannot use the ie11 browser 1. First, right-click the start menu and select "Command Prompt (Administrator)" to open it. 2. After opening, directly enter "Netshwinsockreset" and press Enter to confirm. 3. After confirmation, enter "netshadvfirewallreset&rdqu

How to use JS and Baidu Maps to implement map polygon drawing function. In modern web development, map applications have become one of the common functions. Drawing polygons on the map can help us mark specific areas for users to view and analyze. This article will introduce how to use JS and Baidu Map API to implement map polygon drawing function, and provide specific code examples. First, we need to introduce Baidu Map API. You can use the following code to import the JavaScript of Baidu Map API in an HTML file

Overview of how to use JS and Baidu Maps to implement map click event processing: In web development, it is often necessary to use map functions to display geographical location and geographical information. Click event processing on the map is a commonly used and important part of the map function. This article will introduce how to use JS and Baidu Map API to implement the click event processing function of the map, and give specific code examples. Steps: Import the API file of Baidu Map. First, import the file of Baidu Map API in the HTML file. This can be achieved through the following code:
