https://www.w3schools.com/tags/ev_onload.asp

Example

Execute a JavaScript immediately after a page has been loaded:

<body onload="myFunction()">

Definition and Usage

The onload attribute fires when an object has been loaded.

onload is most often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.). However, it can be used on other elements as well (see "Supported HTML tags" below).

The onload attribute can be used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information.

The onload attribute can also be used to deal with cookies (see "More Examples" below).

Supported HTML tags: <body>, <frame>, <frameset>, <iframe>, <img>, <input type="image">, <link>, <script> and <style>


onload in JavaScript的更多相关文章

  1. javascript版Ajax请求

    什么是Ajax请求,Ajax也就是“Asynchronous JavaScript and XML”(异步JavaScript和XML),无刷新数据读取.能减少流量的消耗,也提高了浏览的流畅性,给用户 ...

  2. 浏览器加载模式:window.onload和$(document).ready()的区别(详解)

    jQuery库文件是在body元素之前加载的,必须等待所有的DOM元素加载后,延迟支持DOM操作,否则就无法获取到. 在延迟等待加载,JavaScript提供了一个事件为load,方法如下: wind ...

  3. JavaScript笔记之第四天

    HTML DOM (文档对象模型) 当网页被加载时,浏览器会创建页面的文档对象模型(Document Object Model). 查找 HTML 元素 通常,通过 JavaScript,您需要操作 ...

  4. JavaScript -- 知识点汇总

    js语法 1. javascript数据类型 JavaScript拥有动态类型.这意味着相同的变量可用作不同的类型:有 字符串,数字, 布尔值, 对象, 数组,Undefined和Null 对象: v ...

  5. html,css.javascript

    基本标签(a.p.img.li.table.div.span).表单标签.iframe.frameset.样式 1:Html  (Hypertext Markup Language) 超文本标记语言 ...

  6. 黑马程序员_java基础笔记(09)...HTML基本知识、CSS、JavaScript、DOM

    —————————— ASP.Net+Android+IOS开发..Net培训.期待与您交流! —————————— 基本标签(a.p.img.li.table.div.span).表单标签.ifra ...

  7. javascript 对象简单介绍(二)

    JavaScript Array(数组) 对象数组对象的作用是:使用单独的变量名来存储一系列的值. 什么是数组?数组对象是使用单独的变量名来存储一系列的值.如果你有一组数据(例如:车名字),存在单独变 ...

  8. JavaScript和jQuery中的方法整理

    一.属性操作 // JavaScript: Dom.hasAttribute('attrName'); //是否有指定属性 Dom.hasAttributes(); //是否有属性 Dom.getAt ...

  9. jQuery基础知识准备

    一. 代码风格在jQuery程序中,不管是页面元素的选择.内置的功能函数,都是美元符号"$"来起始的.而这个"$"就是jQuery当中最重要且独有的对象:jQu ...

随机推荐

  1. Linux yum 命令篇

    yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器. 基於RPM包管理,能够从指定的服务器自动下载RPM包 ...

  2. 2016青岛区域赛.Coding Contest(费用流 + 概率计算转换为加法计算)

    Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  3. AcWing 875. 快速幂

    题目链接:https://www.acwing.com/problem/content/description/877/ 快速幂模板题,计算ab mod p 的值,a,b,p大概1e9左右,可以快速计 ...

  4. 1、Java语言概述与开发环境——JDK的安装与环境变量的配置

    Selenium.Appium.Macaca.RobotFramework.Jmeter等框架或工具均必须的一样东西——JDK,也就是基于java开发的东西都要这个东西.JDK的概念在这里不作描述. ...

  5. TScreen研究(有待研究)

    先扔在这里,待研究: http://blog.csdn.net/lailai186/article/details/8141170 procedure TForm1.Button1Click(Send ...

  6. sublime3跳转函数

    点击Preferences->Browse Packages进入Packages目录,然后打开User目录,查看User目录里面有没有Default (Windows).sublime-mous ...

  7. 各类无次数限制的免费API接口,再也不怕找不到免费API了

    各类无次数限制的免费API接口整理,主要是聚合数据上和API Store上的一些,还有一些其他的. 聚合数据提供30大类,160种以上基础数据API服务,国内最大的基础数据API服务,下面就罗列一些免 ...

  8. git Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.

    只要把那个ip地址添加进hosts列表中就可解决. 参见:https://blog.csdn.net/hunhun1122/article/details/79752125

  9. linux中的文件类型以及查看文件类型的方法

    Linux文件类型和文件的文件名所代表的意义是两个不同的概念,在linux中文件类型与文件扩展名没有关系.它不像Windows那样是依靠文件后缀名来区分文件类型的,在linux中文件名只是为了方便操作 ...

  10. odoo ERP 系统安装与使用

    https://hub.docker.com/_/odoo/ #!/bin/bash sudo docker pull postgres:10sudo docker pull odoo:11.0 su ...