Home > Article > Web Front-end > Some issues with Javascript compatibility with firefox_javascript tips
For example:
1. document.all() does not work in FF. It must be changed to document.getElementById();
2. obj.innerText = "XXX"; There seems to be problems occasionally in FF. Change to obj .innerHTML = "XXX"; will do.
3. var olE = document.body.onload; Get the onload function of the body. IE is fine, but FF is not. Change it to window.onload. Solved.
As for window What is the difference between .onload and body.onload... It remains to be seen by Baidu.
4. In IE, the .event object has x, y attributes. FF does not. In FF, event.x should be event.pageX
Solution. mX = event.x ? event.x : event.pageX; Then use mX instead of event.x.
5. The most hateful thing is that Ajax cannot be called synchronously in FF! ! !
For example, xmlHttp.open("get","xxx.aspx?id=xx",true); //true means asynchronous
No problem in IE and FF. But xmlHttp.open("get","xxx.aspx?id=xx",false); works fine in IE but not in FF!!
This problem has not been solved yet.
6. It’s time to eat. To be continued..
----------
The fifth one is solved.
Write like this when calling synchronously.