方法1.如下程序,当页面完全加载后执行openTheIndexPage()方法<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Telecommunications Data Collection System</title><script type="text/javascript" src="<%=contextPath%>/js/baseframe.js"></script><script type="text/javascript" src="<%=contextPath%>/js/cookies.js"></script><script type="text/javascript" src="<%=contextPath%>/js/tag/tag.js"></script><script language="javascript" for="window" event="onload"> function openTheIndexPage() { openMyURIWithCid(true, 'root', 'IDX', "iframe/dispatch.jsp?url=tdc/zhk/impctrlobjinf/index/index.jsp", '首页', 'top.tagmenu', 'top.maintop', true, 'system/accessPaths.do?currentModuleCode=IDX', 'mainmenu', true); }; if(document.readyState=="complete"){ openTheIndexPage(); } </script></head> <body> </body> </html>方法2:可以是以下几种,但是效果不如方法1. <body onload="function name()"> </body > <script>window.function name </script> <script language="javascript" for="window" event="onload">function name(); </script> 第二种只能写入一个函数,而且无法给变量,其中最好用的是最后一种,可以独立写出来,怎么写都行。方法3:<body onload="xxx()"> </body> xxx()为你要执行的函数方法4:在script标记里加defer 即 <script defer="defer" language="javascript"> 或者 <script defer language="javascript"> 在整个页面加载完后运行脚本。(没有效果)
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow