![]() |
Ie and firefox feud among the Js and Css
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, 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 amuse try not to use. there a way in IE and MF can be used var f = document.forms [> present issue: in IE, DIV object ID can be used directly as an object variable appoint. In the MF can not. DivId.style.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, 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 retinue 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 addition, the mf and ie can be used window.top.document.getElementById (and can be window.top.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 advocate. solution direct use window.open (pageURL, name, parameters) way to open a current window. If you absence to pass parameters,Vibram FiveFingers Kso Trek, 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 directly. In the MF can not, so please try to use normal use id, avoid 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, because 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,Vibram FiveFingers Flow, to avert paradox, 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 sample, obj.parentElement.name should be changed to obj.parentNode.attributes.getNamedItem (W3C does not support 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 high resolution IE: elevation of the content will alteration, including the highly defined picture content, even now the meaning of the height, When the content exceeds the height, it will use the tangible height Firefox: height is not defined, if the content includes image content, MF is based on high resolution publishing criteria, this will occasion a high degree and the actual content does not meet the situation; When defining the height, but extra than the content height, the content is appearance the defined height, but does not change the neatness used in the region, resulting in dislocation style. Conclusion: We can make sure the content height in the circumstance of the best definition of height, if actually no way to define the height, not the best use of border 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 detailing. in IE if no title, alt tip can also be used as img, but in the MF, the two are completely in agreement with the standard definition used Conclusion: We define img object,Vibram FiveFingers Classic, and eventually the alt and object to jot the whole heading, assure that entire browsers can be used normally other details of the differences When you write css time, principally with the float: left (or right) sorted in a channeling picture , you will find inside normal in firefox and IE there are problems. Whether you use margin: 0, or border: 0 to detain, to no avail. fact, there is distinct issue here, is a space for the handling of IE, firefox and IE is ignored for blocks and blocks the spaces between the deal. That is followed by a div after the end of a div to write in the middle do not have chariot returns or spaces. Otherwise, there may be problems, such as 3px deviation, and for this reason complicated to find. quite fortunate that I ran into this problem, a digit of img label accompanied, and then define the float: left, wish these pictures can be put together. However, normal results in firefox and IE inside each of which displays are separated along a img 3px. I have cleared the spaces among the names have no efficacy. later solution is set out in the img li, and the definition of li margin: 0, this would resolve the IE and firefox display bias. IE because some models to unravel the publish will have a lot of errors, just attempt to detect a lot of causes. This is just some simple difference, act the layout and CSS design time can be taken into list, but the most efficient and uncomplicated solution to compatibility problems, or with TABLE table, the chart has a agreeable compatibility in the extravaganza. Also in JS template chart, they also need to consider 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 [ many of the existing code to use a accumulation level object access (), IE can adopt, MF can not. (2) Solution: use [] as subscripting. Such as: document.forms ( Another example: document.getElementsByName ((MF window.event can not run on (2) Solution: MF of the event can only use the scene of the episode, can not solve this problem temporarily. Can be modified: the incipient code (can be scamper in IE): new code (which can run in IE and MF): In addition, if the new code does not change the first line, the same object with the old code (that is, not to shriek gotoSubmit parameters), is still only running in IE, but not go bad. Therefore, this portion of the procedure 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 while you can use the Inline HTML method, you can with Event property defined. 1, using Inline HTML methods, such as: ie can you access the id alternatively name corresponding to the window frame and mf only object by name to access the 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: merely this window . altitude.frameName to access the skylight 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 border can also be passed window.top . frameName.position = 'xx.htm' to switch on the frame of the frame and window content description can be found in bbs's 'window and frame' article ; and / test / js / test_frame / catalogue test ---- adun 2004.12.09 modify 9. mf in their defined properties must getAttribute () to obtain 10. parentElement parement.children not in mf and use parentNode parentNode.childNodes childNodes meaning of the subject under different in IE and MF, MF to use the DOM specification, childNodes inserted into the empty text nodes. generally can node.getElementsByTagName () to avoid this problem. When lacking 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 following 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 misdeed. (2) Solution: do not use const, with the var instead. 12. body object MF's body in the body tag has not been completely peruse into the explorer ahead the subsistence 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.action = url then possible will not be displayed properly so that the url parameter is not correct to the server server error parameter is not normally found in the tpl way, if the exception Because tpl in line with xml descriptions, requirements & writing for the common MF & not recognize js in & 14. nodeName and tagName issues (1) existing question: in MF, all nodes are nodeName amount, but textNode not tagName value. In IE, nodeName use if there are problems (not tested the characteristic position, but my IE has been dead several times). (2) Solution: use tagName, but should be detected is vacant. 15. element attributes IE beneath input.type read-only property, yet tin be modified below 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 unit (Are there other elements can not take not know). 17. DOM data island issues (1) existing problems in IE, label has a special significance, can be contained XML DOM, and HTML components and can achieve file binding in the MF in, is just an nameless tag only. In addition, the IE is, really means here is an ActiveX object, but it hung in the HTML DOM tree of the body as a knot , which traverses the DOM tree would be seriously affected. (2) solution IE data binding machinery is to use JS to pretend, but also many distress, it is recommended not to use data binding machinery or find the library to do to effect this simulation, we only consult how to implement the DOM compatible. Known in the MF in both HTML tags or other marks in line with the XML specification, the DOM tree are used to deal with a unified , accordingly,Vibram Five Fingers, MF in fact can use the DOM data isle, but with little difference between IE: In IE is a DOM document, and in the MF only DOM node. This difference is normally less infestation. But there is a small elaborate, in order to fairly overbearing syntax compatible with HTML, MF does not recognize the abbreviation of the empty brand. such as: and is dictation, MF ambition no acknowledge, it should be written as: However, I doubt if XHTML, may not have this problem, but I have not tried. For IE, the HTML DOM architecture interference problems, the course I deal with it later the DOM from the HTML in the canceled. do not know no better solution. |
All times are GMT. The time now is 12:01 PM. |
Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum