1 object problem
1.1 Form object
existing problems:
existing code which access the form object by document.forms (
solution:
use as subscripting. To document.forms [in IE,
Women FiveFingers Performa Jane, HTML document object ID can be a subordinate object as a variable name directly. In the MF can not.
document.all (
Remarks
document.all is IE-defined methods, so please try not to use.
there a course in IE and MF can be used
var f = document.forms [> new issue:
in IE, DIV object ID can be used directly as an object variable name. In the MF can not.
DivId.manner.display = DIV object method or not, use the getElementById method. See 1.2
1.4
on frame
existing problems in IE can window.testFrame obtain the frame,
Vibram FiveFingers Kso, mf not
solution
in the frame of the MF and the use of The main difference is that IE:
if written in the frame label in the emulating attributes:
then IE can access the id or name corresponding to the frame window object
and mf can only be accessed by this name frame corresponding to the window object
example, if the frame label written on the top of the window inside the htm which then can be accessed
IE: window.top.frameId or window.top.frameName to access the window object
MF: window.top.frameName only way to access the window object
In increase, the mf and ie can be used window.altitude.file.getElementById (and can be window.altitude.document.getElementById (switch frame content
1.5
existing problems
IE window can be opened by showModalDialog and showModelessDialog modal and non-modal window, but the MF does not support.
solution
direct use window.open (pageURL, name, parameters) way to open a new window.
If you need to pass parameters, you can use frame or iframe.
2.
2.1 summarizes the assorted objects defined in the JS variable name, try to use the id, to avoid name.
in IE, HTML document object ID can be a subordinate object as a variable name instantly. In the MF can not, so amuse attempt to use normal use id, dodge using only name, instead of using the id.
2.2 variable name with an HTML object id the same problem
existing problems in the MF, for the object id is not the name of the object as HTML, so you can use the HTML object id with the same variable name, IE can not.
solution
in a statement variables, all with var, to avoid ambiguity, this can also be run in IE.
In addition, it is best not to take the HTML object id with the same variable name in order to reduce errors.
1. document.all
Firefox compatible document.all, but generates a advising. You can use the getElementById (
2. parentElement
this is not compatible. For example,
Vibram FiveFingers New Styles, obj.parentElement.name should be changed to obj.parentNode.attributes.getNamedItem (W3C does not advocate windows.event
example:
in IE
function onMenuClick (evt)
if (evt == null)
evt = window.event; / / For IE
var srcElement = evt.srcElement? evt.srcElement: evt.target; / / IE use srcElement, while Firefox uses the target
collapseMenu (srcElement);
IE and FIREFOX CSS parsing the difference between places of lofty resolution
IE: height of the content will change,
Vibram FiveFingers, including the extremely defined image content, even if the definition of the height, When the content exceeds the height, it will use the actual height
Firefox: height is not defined, if the content includes image content, MF is based on high resolution publishing standards, this will reason a high degree and the actual content does not meet the situation; When defining the height, but more than the content height, the content is outdoor the defined height, but does not change the style used in the region, resulting in dislocation style.
Conclusion: We can make sure the content height in the case of the best definition of height, if truly no way to define the height, not the best use of boundary styles, or styles that there will be chaos!
img alt and title of the resolution object
alt: When the photo does not exist or load error prompts;
title: photo tip specification.
in IE whether no heading, alt peak can also be used for img, but in the MF, the 2 are entirely in consensus with the standard elucidation used
Conclusion: We define img object, and finally the alt and object to write the entire title, ensure that all browsers can be used normally
other details of the differences
When you write css time, primarily with the float: left (or right) laid in a channeling picture , you will ascertain inside regular in firefox and IE there are problems. Whether you use margin: 0, or border: 0 to curb, to not avail.
truth, there is variant issue here, is a space for the handling of IE, firefox and IE is ignored for blocks and blocks the spaces between the handle. That is followed by a div after the end of a div to write in the navel do not have chariot returns or spaces. Otherwise, there may be problems, such as 3px discrepancy, and for this reason laborious to find.
very fortunate that I ran into this problem, a number of img label spliced, and then define the float: left, hope these pictures can be put together. However, normal results in firefox and IE inside each of which displays are separated by a img 3px. I have removed the spaces among the labels have no efficacy.
afterward solution is set out in the img li, and the definition of li margin: 0, this would decide the IE and firefox display discrimination. IE as some models to unravel the issue will have a lot of errors, equitable try to find a lot of reasons.
This is just some uncomplicated difference, doing the layout and CSS design time can be taken into account, but the most efficacious and easy solution to compatibility problems, or with TABLE chart, the table has a agreeable compatibility in the representation.
Also in JS template devise, they also absence to think both the code compatible with IE and FIREFOX following are some tests in JS:
the following to IE instead of Internet Explorer, to MF instead of Mozilla Firefox
1. document. form.item problem
(1) existing problems:
existing code, there are many document.formName.item (can not run in the MF
(2) Solution:
use document.formName. elements [
numerous of the existing code to use a collection class object access (), IE can approve, MF can not.
(2) Solution:
use [] as subscripting. Such as: document.fashions (
Another example: document.getElementsByName ((MF window.event can not run on
(2) Solution:
MF of the event can only use the scene of the incident, can not solve this problem temporarily. Can be modified:
the elemental code (can be run in IE):
current code (which can run in IE and MF):
In addition, if the new code does not change the 1st line, the same thing with the old code (that is, not to cry gotoSubmit
parameters),
Women Vibram FiveFingers Kso, is still only fleeing in IE, but not work wrong. Therefore, this part of the program is still with the old
tpl code compatible.
/////////////////////////////////// ////////////////////////////////////
; / / The following comes from users llihua
/ / event handler
feature a (evt) / / FireFox
evt = evt? evt: window.event; / / IE
var srcElem = (evt.target)? evt.target: evt.srcElement;
/ / event handling ...
in linkage event handler when you can use the Inline HTML method, you can with Event
property defined.
1, using Inline HTML means, such as:
ie can you way the id or label corresponding to the window border and mf merely object
by name to access the frame corresponding to the window object
example, if the frame name written above the top of the window inside the htm which then can be accessed
; ie: window.top.frameId or window.top.frameName to access the window object
mf: only this window . top.frameName to access the window object
In addition, the mf and ie can be used in
; window.top.document.getElementById (
and can
window.top.document.getElementById (. src = 'xx.htm'
to switch the contents of the frame can also be passed window.top
. frameName.location = 'xx.htm' to switch on the frame of the frame and window content
description can be found in bbs's 'window and frame' treatise
; and / test / js / test_frame / directory test
---- adun 2004.12.09 adjust
9. mf in their defined properties must getAttribute () to obtain
10. parentElement parement.babies not in mf and use
parentNode parentNode.childNodes
childNodes meaning of the subject below differ in IE and MF, MF to use the DOM specification, childNodes inserted into the vacant
text nodes.
generally can node.getElementsByTagName () to avoid this problem.
When missing html node, IE and MF for different interpretations of parentNode, such
MF in input.parentNode value form, while in IE input.parentNode is empty in the node
MF node does not removeNode method, you must use the retinue method
node.parentNode.removeChild (node)
11.const problem
(1) existing problems:
in IE not using the const keyword. Such as const constVar = 32;
in IE, this is a syntax peccadillo.
(2) Solution:
do not use const, with the var instead.
12. body object
MF's body in the body tag has not been completely read into the explorer ahead the existence of the IE must be completely peruse into the body after
there
13. url encoding
written in the js in the url if you do not directly write & write & such
var url = 'xx.jsp? objectName = xx & objectEvent = xxx' ;
frm.behavior = url then likely will not be displayed properly so that the url parameter is not correct to the server
server error parameter is not usually base in the tpl
course, if the exception Because tpl in line with xml specifications, requirements & writing for the general MF &
not recognize js in &
14. nodeName and tagName issues
(1) existing question:
in MF, all nodes are nodeName value, merely textNode no tagName value. In IE,
nodeName
use if there are problems (not tested the specific location, but my IE has been die several times).
(2) Solution:
use tagName, but should be found is empty.
15. element attributes
IE under input.type read-only property, but can be modified under ME
16. document.getElementsByName () and document.all [name] problem
(1) existing problems:
in IE, getElementsByName (), document.all [name] can not be used to get a div element
(Are there other ingredients can not take not understand).
17. DOM file island issues
(1)
existing problems in IE, label has a special significance, can be embodied XML DOM, and HTML components and can achieve data
binding in the MF in, is just an nameless tag only.
In addition, the IE is, really manner here is an ActiveX object, but it hung in the HTML DOM tree of the
body as a node , which traverses the DOM tree would be seriously affected.
(2) solution
IE data binding mechanism is to use JS to simulate, but too much difficulty, it is recommended not to use data binding mechanism or
find the library to do to achieve this simulation, we only consult how to appliance the DOM compatible.
Known in the MF in either HTML tags alternatively additional marks in line with the XML specification, the DOM tree are accustomed to handle with a unified
, accordingly, MF in fact can use the DOM data island, but with little difference between IE: In IE
is a DOM document, and in the MF only DOM node. This difference is normally fewer infestation.
But there is a small elaborate, in array to fairly overbearing syntax compatible with HTML, MF does not recognize the abridgement of the vacant mark.
such as: and is shorthand, MF will not recognize, it ought be written as:
However, I doubt if XHTML, may not have this problem, but I have not tried.
For IE, the HTML DOM framework interference problems, the way I deal with it behind the
DOM from the HTML in the canceled. do not know no better solution.