


Common compatibility issues between IE and Firefox_PHP tutorial
1. document.form.item problem
(1)Existing problems:
There are many statements like document.formName.item("itemName") in the existing code, which cannot be run under Firefox
(2)Solution:
Use document.formName.elements["elementName"] instead
2. Collection object problem
(1)Existing problems:
Many collection objects in the existing code use () when accessing them. IE can accept it, but Firefox cannot.
(2)Solution:
Use [] as subscript operation instead. Such as:
document.forms("formName") is changed to document.forms["formName"].
Another example:
document.getElementsByName("inputName")(1) changed to document.getElementsByName("inputName")[1]
3. window.event
(1)Existing problems:
Using window.event cannot run on Firefox browser
(2)Solution:
Firefox’s event can only be used at the scene where the event occurs. This problem cannot be solved yet. You can change it like this:
Original code (can run in IE):
...
New code (works in IE and Firefox):
...
In addition, if the first line in 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 run in IE, but there will be no error. Therefore, the tpl part of this solution is still compatible with the old code.
4. The problem of using the id of the HTML object as the object name
(1)Existing problems
In IE, the ID of the HTML object can be used directly as the variable name of the subordinate object of document. Not in Firefox.
(2)Solution
Use getElementById("idName") instead of idName as an object variable.
5. Problem with obtaining objects using idName string
(1)Existing problems
In IE, you can use eval(idName) to get the HTML object with the id idName, but not in Firefox.
(2)Solution
Use getElementById(idName) instead of eval(idName).
6. The problem that the variable name is the same as the ID of an HTML object
(1)Existing problems
In Firefox, because the object id is not used as the name of the HTML object, you can use the same variable name as the HTML object id, which works in IE.
(2)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 use the same variable name as the HTML object id to reduce errors.
7. Event.x and event.y issues
(1)Existing questions
In IE, the event object has x, y attributes, but not in Firefox.
(2)Solution
In Firefox, the equivalent of event.x is event.pageX. But event.pageX is not available in IE. Therefore, event.clientX is used instead of event.x. This variable also exists in IE. There are subtle differences between event.clientX and event.pageX (when the entire page has scroll bars), but they are equivalent most of the time.
If you want it 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
(3)Others
event.layerX exists in IE and Firefox. Whether there is any specific difference has not yet been tested.
8. About frame
(1)Existing questions
In IE, you can use window.testFrame to obtain the frame, but not in Firefox
(2)Solution
The main difference between Firefox and IE in terms of the use of frames 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, while Firefox 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 IE like this : window.top.frameId or window.top.frameName to access this window object
Firefox: This window object can only be accessed through window.top.frameName
In addition, in both Firefox and IE, you can use window.top.document.getElementById("frameId") to access the frame tag and window.top.document.getElementById("testFrame").src = 'xx.htm' To switch the content of the frame, you can also switch the content of the frame through window.top.frameName.location ='xx.htm'. For descriptions of frame and window, please refer to the 'window and frame' article of bbs and /test/js/test_frame Tests under / directory
9. In Firefox, the attributes you define must be obtained through getAttribute()
10. There is no parentElement parement.children in Firefox but
parentNode parentNode.childNodes The meaning of the subscripts of childNodes is different in IE and Firefox. Firefox uses DOM specifications, and blank text nodes will be inserted into childNodes.
You can generally avoid this problem through node.getElementsByTagName().
When a node is missing in html, IE and Firefox interpret parentNode differently, for example
The value of input.parentNode in Firefox is form, while the value of input.parentNode in IE is an empty node
There is no removeNode method for nodes in Firefox, you must use the following method node.parentNode.removeChild(node)
11.const problem
(1)Existing questions:
The const keyword cannot be used in IE. Such as const constVar = 32; This is a syntax error in IE.
(2)Solution:
Do not use const, use var instead.
12. body object
Firefox’s body exists before the body tag is fully read by the browser, while IE’s body must exist after the body is fully read
13. url encoding
If you write a url in js, write it directly & don’t write it. For example, var url = 'xx.jsp?objectName=xx&objectEvent=xxx'; frm.action = url. Then it is very likely that the url will not be displayed normally and the parameters are incorrect. When transmitted to the server, the server will usually report an error. The parameter is not found. Of course, the exception is if it is in tpl, because tpl conforms to the xml specification and requires & to be written as &. Generally, Firefox cannot recognize & in js.
14. nodeName and tagName problem
(1)Existing questions:
In Firefox, all nodes have nodeName value, but textNode does not have tagName value. In IE, there seems to be a problem with the use of nodeName (the specific situation has not been tested, but my IE has died several times).
(2)Solution:
Use tagName, but should detect if it is empty.
15. Element attributes
The input.type attribute is read-only under IE, but it can be modified under Firefox
16. Problems with document.getElementsByName() and document.all[name]
(1)Existing questions:
In IE, getElementsByName() and document.all[name] cannot be used to obtain div elements (it is not known whether there are other elements that cannot be obtained).
17. The simplest CSS for mouse over hand transformation is going to be changed
cursor:pointer;/*ff does not support cursor:hand*/ The attribute automatically produced under dw8 does not have the attribute hand. The standard one is pointer
18.ff does not support filters. The most common translucency is not supported.
filter: Alpha(Opacity=50); /* for IE */
opacity: .5;/* for Firefox */
style="-moz-opacity:0.5; filter:alpha(opacity=50);cursor:hand;" onmouseover="this.style.MozOpacity=1;
this.filters.alpha.opacity=100" onmouseout="this.style.MozOpacity=0.5;
this.filters.alpha.opacity=50"
19.ff does not support expression. For example, to remove the border of a link, you need to write different css separately
a,area { blr:expression(this.onFocus=this.blur()) } /* for IE */
:focus { outline: none; } /* for Firefox */
20.ff does not support the color setting of the div scroll bar, and there is currently no good way to replace it.
.content {
position: absolute; left: 0px; top: 10px; width: 580px; height: 135px;
line-height:120%;text-align:left; font-family:"宋体";word-break : break-all; color:#6D6E71;
OVERFLOW-Y:auto;OVERFLOW-X:no;
SCROLLBAR-ARROW-COLOR: red; SCROLLBAR-TRACK-COLOR: F6F6F6; SCROLLBAR-FACE-COLOR: #F6F6F6; SCROLLBAR-SHADOW-COLOR: #F6F6F6;
SCROLLBAR-DARKSHADOW-COLOR:#F6F6F6;SCROLLBAR-3DLIGHT-COLOR:#F6F6F6;SCROLLBAR-HIGHLIGHT-COLOR:#F6F6F6;
}
This has no effect at all in FF.
21.ie, the horizontal line below the text is displayed
border-width: 0px 0px 1px 0px; it goes to the text in ff. (I checked the manual and still couldn’t find a solution. It feels strange~~ It turns out that the fault tolerance of ff is too poor, which is caused by the following width: 186px; height: 0px;. In fact, a:haver has inherited the superior one. Attributes, just define different styles. It seems that ff helps to create standardized and concise web pages. It also has a deeper understanding of css, which is a good help for providing css)
.onelinksdiv a:hover {
display: block;border-style: solid;color: #ff0000;border-width: 0px 0px 1px 0px;
/*
display: block;border-style: solid; border-width: 0px 0px 1px 0px; width: 186px;height: 0px; color: #ff0000; font-size: 14px;text-align: right;
*/
}
//The following writing method is normal under ie, but it is wrong under ff
.onelinksdiv a:hover {
display: block;border: #ff0000 solid; border-width: 0px 0px 1px 0px;
width: 186px;height: 0px; color: #ff0000; font-size: 14px;text-align: right;
}
Related references:
border-width:border-top-width border-right-width border-bottom-width border-left-width; p#fourborders
{
border-width:thick medium thin 12px;
}
If four values are defined, then these four values are the width values of the top, right, bottom, and left borders (starting from the top border and traversing in counterclockwise order).
Equivalent to the following definition
p #fourborders
{
border-top-width:thick;
border-right-width:medium;
border-bottom-width:thin;
border-left-width:12px;
}
22.ff does not support the
scroll attributeoverflow:hidden must be defined; and it must be under the html tag, not under the body
html{
overflow:hidden;
}
23.ff does not support data island binding
24.style="word-break:break-all"
When the content of the cell in the web page exceeds one line, the line break style defined in the IE browser can be used normally, but it is not supported in Firefox. style="word-break:break-all" is MS The extended IE-specific property has not become a W3C standard, so Firefox does not yet support it. However, MS has submitted it to W3C, and it can also be seen in the W3C's CSS3 candidate plan. I hope Firefox can support this property after it is finalized as a CSS3 standard by the W3C. Before that, you can try it
style="table-layout:fixed;word-wrap: break-word" (When it is in English, it cannot wrap normally)
25. Currently, FF2.0 does not support IE’s name anchor
Writing like this is not supported: go back
It turns out that according to W3C syntax, the tag will always search for the href address and jump to it. Now the onclick event conflicts with the ### address.
In order to make Firefox compatible with some element attributes of IE, I accidentally discovered that Firefox is sensitive to spaces:
//With spaces, the anchor point works
//No space, anchor point has no effect
The way to write the anchor point is very particular, such as , Firefox does not support anchor points, so you have to add id=#1
When referencing the same page statically, you must write like this: , will not work*** *Status pages need to use JS
The sequelae are here, considering the mouse style and browser compatibility, I started tossing again:
//Incompatible
//Incompatible
//Without {...}, it is illegal writing of script
// Didn't take care of users who customize the system mouse style
I thought that a lot of people use Firefox, but according to the statistical analysis of the website, Firefox only has a pitiful 3.18%, but it does take a lot of effort to be compatible with its standards! However, standardization is conducive to future maintenance and expansion, and is conducive to continuous reminders of technology.
-->
Question 14: OVERFLOW-Y:auto;OVERFLOW-X:hidden; You can use no to hide in IE, but you must use hidden in FireFox

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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



What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should

What does the 0x000000d1 blue screen code mean? In recent years, with the popularization of computers and the rapid development of the Internet, the stability and security issues of the operating system have become increasingly prominent. A common problem is blue screen errors, code 0x000000d1 is one of them. A blue screen error, or "Blue Screen of Death," is a condition that occurs when a computer experiences a severe system failure. When the system cannot recover from the error, the Windows operating system displays a blue screen with the error code on the screen. These error codes

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

SPDIFOUT connection line sequence on the motherboard. Recently, I encountered a problem regarding the wiring sequence of the wires. I checked online. Some information says that 1, 2, and 4 correspond to out, +5V, and ground; while other information says that 1, 2, and 4 correspond to out, ground, and +5V. The best way is to check your motherboard manual. If you can't find the manual, you can use a multimeter to measure it. Find the ground first, then you can determine the order of the rest of the wiring. How to connect motherboard VDG wiring When connecting the VDG wiring of the motherboard, you need to plug one end of the VGA cable into the VGA interface of the monitor and the other end into the VGA interface of the computer's graphics card. Please be careful not to plug it into the motherboard's VGA port. Once connected, you can

Quickly get started with Python drawing: code example for drawing Bingdundun Python is an easy-to-learn and powerful programming language. By using Python's drawing library, we can easily realize various drawing needs. In this article, we will use Python's drawing library matplotlib to draw a simple graph of ice. Bingdundun is a cute panda who is very popular among children. First, we need to install the matplotlib library. You can do this by running in the terminal

As a programmer, I get excited about tools that simplify the coding experience. With the help of artificial intelligence tools, we can generate demo code and make necessary modifications as per the requirement. The newly introduced Copilot tool in Visual Studio Code allows us to create AI-generated code with natural language chat interactions. By explaining functionality, we can better understand the meaning of existing code. How to use Copilot to generate code? To get started, we first need to get the latest PowerPlatformTools extension. To achieve this, you need to go to the extension page, search for "PowerPlatformTool" and click the Install button

Working with files in the Linux operating system requires the use of various commands and techniques that enable developers to efficiently create and execute files, code, programs, scripts, and other things. In the Linux environment, files with the extension ".a" have great importance as static libraries. These libraries play an important role in software development, allowing developers to efficiently manage and share common functionality across multiple programs. For effective software development in a Linux environment, it is crucial to understand how to create and run ".a" files. This article will introduce how to comprehensively install and configure the Linux ".a" file. Let's explore the definition, purpose, structure, and methods of creating and executing the Linux ".a" file. What is L
