什么时候onLoad被调用? [英] When does a body onLoad gets called?

查看:119
本文介绍了什么时候onLoad被调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解什么时候 onload 被调用了



我读过 w3school onload =文档加载时运行的脚本这是什么意思?



这是否意味着


  1. html / jsp页面在像任何 table 或jsp scriplets(例如:<%= request.getParameter(NAME))呈现任何元素之前被加载%>

  2. 或者是在页面/正文呈现之后​​?

例如:
我有一堆params (<%= request.getParameter(NAME)%>,...)所以为了使用它们,我将它们放置在一些隐藏的形式项目&那么在身体负荷上我可以使用它们吗? w3schools MDN解释事件何时开始


load事件在文档加载过程结束时触发。此时,文档中的所有对象都位于DOM中,并且所有图像和子帧都已完成加载。

因此,DOM树已准备就绪所有元素都已加载。


I need to understand when does a body's onload gets called

I read in w3school that onload=Script to be run when a document load what does this mean?

Does it mean that

  1. the html/jsp page gets loaded before rendering any elements in the body like any table or jsp scriplets eg: <%= request.getParameter("NAME") %>
  2. Or is it after the page/body is rendered?

for example: I have a bunch of params (<%= request.getParameter("NAME") %>,...) so in order to use them i'll place them in some hidden form item & then on body load can I use them?

解决方案

Unlike w3schools, MDN explains when the event is fired:

The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images and sub-frames have finished loading.

So the DOM tree is ready and all elements have been loaded.

这篇关于什么时候onLoad被调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆