Home >Web Front-end >JS Tutorial >A small script to load js files_javascript skills

A small script to load js files_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:12:00957browse
Copy code The code is as follows:

// Replace the path below with the path where your js file is located.
$js_path = "http://www.soojs.com/js/";

function js_include($script){
var script = document.createElement('script');
script.src = $js_path $script;
script.type = 'text/javascript';
var head = document.getElementsByTagName('head').item(0);
head.appendChild (script);
}

//Change the question to your file
js_include("prototype.js");
js_include("scriptaculous.js");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn