JavaScript is inevitable when doing BS development, and each browser has different support for JavaScript. This requires us programmers to be compatible with them, otherwise some browsers will not be able to run our code. It will cause complaints from customers. If BoSS knows, it will not be good.
Below are the practices and decompositions of JS scripts that are compatible with IE and FF (parts selected from the Internet and compiled by me). I hope they will be helpful to everyone.
.The following is to replace Internet Explorer with IE and use MF/FF to replace Mozzila Firefox
//window.event
IE: There is a window.event object
FF: There is no window.event object. The event object can be passed to the parameter of the function. For example, onmousemove=doMouseMove(event)
Solution: var event = event || window.event;
example:
<script> function test(event) { var event = event || window.event; //do Something }</script><input type="button" value="click" onclick="test(event)"/>