在js中执行脚本标记

时间:2015-11-09 14:31:39

标签: javascript html

是否可以从其他脚本标记执行javascript,例如:

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

 <script>
    script 2
 </script>

1 个答案:

答案 0 :(得分:0)

如果脚本2是内联的,您可以这样做:

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