如何启动一组网站的javascript代码启动(一个函数) [英] How do I start a set of javascript code startup of a website (a function)

查看:62
本文介绍了如何启动一组网站的javascript代码启动(一个函数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How do I start a set of javascript code startup of a website (a function heading, onload or something)





我尝试过:



function onload(){



}



我知道存在一段执行此功能的代码。我还没有找到它。



What I have tried:

function onload(){

}

I know there exists a piece of code that does this function. I just have not found it yet.

推荐答案

请参阅 JavaScript和HTML DOM参考 [ ^ ]。


试试: JavaScript Events [ ^ ]

好​​教程网站:W3Schools在线网络教程 [ ^ ]
Try there: JavaScript Events[^]
Good tutorial site: W3Schools Online Web Tutorials[^]


您是否正在寻找 [ ^ ]

+++++ [第2轮] + ++++

它只是一个通用术语,指的是一个可以是任何HTML元素的JavaScript对象换货。所以这取决于。让我们借用 Tryit Editor v3.3 [ ^ ]
Are you looking for me[^]
+++++[round 2]+++++
It is just a generic term that refers to a JavaScript object which can be any HTML element. So it depends. Let borrow the example from Tryit Editor v3.3[^]
document.getElementById("myFrame").onload = function() {myFunction()};



对象引用由id =myFrame标识的html文档中的iframe元素。在JavaScript中,这是通过


The object refers to the iframe element in the html document identified by id="myFrame". In JavaScript, this is selected via

document.getElementById("myFrame")

选择的。当加载了对象(在本例中为iframe)时,将触发onload事件。

. The onload event will be triggered when the object, that is the iframe in this case, has been loaded.


这篇关于如何启动一组网站的javascript代码启动(一个函数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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