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에서는

如何使用JS和百度地图实现地图平移功能百度地图是一款广泛使用的地图服务平台,在Web开发中经常用于展示地理信息、定位等功能。本文将介绍如何使用JS和百度地图API实现地图平移功能,并提供具体的代码示例。一、准备工作使用百度地图API前,首先需要在百度地图开放平台(http://lbsyun.baidu.com/)上申请一个开发者账号,并创建一个应用。创建完成

如何使用JS和百度地图实现地图多边形绘制功能在现代网页开发中,地图应用已经成为常见的功能之一。而地图上绘制多边形,可以帮助我们将特定区域进行标记,方便用户进行查看和分析。本文将介绍如何使用JS和百度地图API实现地图多边形绘制功能,并提供具体的代码示例。首先,我们需要引入百度地图API。可以利用以下代码在HTML文件中导入百度地图API的JavaScript

js字符串转数组的方法:1、使用“split()”方法,可以根据指定的分隔符将字符串分割成数组元素;2、使用“Array.from()”方法,可以将可迭代对象或类数组对象转换成真正的数组;3、使用for循环遍历,将每个字符依次添加到数组中;4、使用“Array.split()”方法,通过调用“Array.prototype.forEach()”将一个字符串拆分成数组的快捷方式。

如何使用JS和百度地图实现地图热力图功能简介:随着互联网和移动设备的迅速发展,地图成为了一种普遍的应用场景。而热力图作为一种可视化的展示方式,能够帮助我们更直观地了解数据的分布情况。本文将介绍如何使用JS和百度地图API来实现地图热力图的功能,并提供具体的代码示例。准备工作:在开始之前,你需要准备以下事项:一个百度开发者账号,并创建一个应用,获取到相应的AP

js中new操作符做了:1、创建一个空对象,这个新对象将成为函数的实例;2、将新对象的原型链接到构造函数的原型对象,这样新对象就可以访问构造函数原型对象中定义的属性和方法;3、将构造函数的作用域赋给新对象,这样新对象就可以通过this关键字来引用构造函数中的属性和方法;4、执行构造函数中的代码,构造函数中的代码将用于初始化新对象的属性和方法;5、如果构造函数中没有返回等等。

这篇文章主要为大家详细介绍了js实现打字小游戏,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。

php在特定情况下可以读js内部的数组。其方法是:1、在JavaScript中,创建一个包含需要传递给PHP的数组的变量;2、使用Ajax技术将该数组发送给PHP脚本。可以使用原生的JavaScript代码或者使用基于Ajax的JavaScript库如jQuery等;3、在PHP脚本中,接收传递过来的数组数据,并进行相应的处理即可。

js全称JavaScript,是一种具有函数优先的轻量级,直译式、解释型或即时编译型的高级编程语言,是一种属于网络的高级脚本语言;JavaScript基于原型编程、多范式的动态脚本语言,并且支持面向对象、命令式和声明式,如函数式编程。


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

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

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
