Use javascript to inject script references as needed?

后端 未结 6 844
终归单人心
终归单人心 2020-12-08 03:20

I have a JS function that may occasionally get used on some pages. It is dependent on another JS file (swfObject.js), but I\'d like to avoid having to include this file all

6条回答
  •  情话喂你
    2020-12-08 04:01

    Checkout the YUI Loader utility. It's super handy, unobtrusive javascript for loading scripts on-demand.

    Here's a link to an example using non-YUI scripts:

    http://developer.yahoo.com/yui/examples/yuiloader/yl-addmodule.html

提交回复
热议问题