Javascript cross browser property determination method
- 2020-03-30 02:23:21
- OfStack
Therefore, it is recommended to use hasOwnProperty or typeof to judge the value correctly.
var sLeft = window.screenLeft;
if( !window.hasOwnProperty('screenLeft')) sLeft = window.screenX;