Method 1:Run the openTheIndexPage () method after the page is fully loaded as follows:
Copy codeThe Code is as follows:
<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. js"> </script>
<Script language = "javascript" for = "window" event = "onload">
Function openTheIndexPage (){
OpenMyURIWithCid (true, 'root', 'idx', "iframe/dispatch. jsp? Url = tdc/zhk/impctrlobjinf/index. jsp ", 'homepage ',
'Top. tagmenu ', 'top. maintop', true,
'System/accessPaths. do? CurrentModuleCode = idx ',
'Mainmenu ', true );
};
If (document. readyState = "complete "){
OpenTheIndexPage ();
}
</Script>
</Head>
<Body>
</Body>
</Html>
Method 2: It can be the following, but the effect is not as good as method 1.
Copy codeThe Code is as follows:
<Body onload = "function name ()"> </body>
<Script> window. onload = function name </script>
<Script language = "javascript" for = "window" event = "onload"> function name (); </script>
In the second method, only one function can be written, and no variable can be given. It is best to use the last function, which can be written independently.
Method 3: <Body onload = "xxx ()"> </body> xxx () indicates the function you want to execute.
Method 4: Add defer to the script tag
That is, <script defer = "defer" language = "javascript">
Or <script defer language = "javascript">
Run the script after the whole page is loaded. (No effect)