【问题标题】:Is there a way of calling a script tag and style tag from within a function in Javascript? [duplicate]有没有办法从 Javascript 的函数中调用脚本标签和样式标签? [复制]
【发布时间】:2015-01-31 06:50:25
【问题描述】:

我正在尝试实现这样的东西:

function ()
{
     <script src="js/jquery.min.js"></script>
}

基本上我想从function 加载.js 文件。任何建议都会很有帮助。

【问题讨论】:

标签: javascript jquery json jquery-mobile


【解决方案1】:
function loadjs(src){
  var js=document.createElement('script')
  js.setAttribute("type","text/javascript")
  js.setAttribute("src", src)
}



//loadjscssfile("https://code.jquery.com/jquery-2.1.3.min.js")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-18
    • 2023-04-02
    • 2019-08-29
    • 2011-09-10
    • 2018-12-14
    • 2019-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多