简体   繁体   中英

Execute script tag in js

Is it possible to execute javascript from another script tag so for example:

 <script>
    script 1 
    execute script 2 from other script tag here after first script is completed
 </script>

 <script>
    script 2
 </script>

If script 2 is inline, you can do this:

<script>
  function1() {
    ...
  }
  window.onload=function() {
    function1(); 
    function2(); 
  }
</script>
<script>
function2() { ... }
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM