简体   繁体   English

在js中执行脚本标签

[英]Execute script tag in js

Is it possible to execute javascript from another script tag so for example: 是否可以从另一个脚本标签执行javascript,例如:

 <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: 如果脚本2是内联脚本,则可以执行以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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