What exactly is the difference between the window.onload
event and the onload
event of the body
tag? when do I use which and how should it be done correctly?
标签:
javascript
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
If you're trying to write unobtrusive JS code (and you should be), then you shouldn't use
<body onload="">
.It is my understanding that different browsers handle these two slightly differently but they operate similarly. In most browsers, if you define both, one will be ignored.