Home  >  Article  >  Web Front-end  >  Summary of implementation methods for calling js in js files_javascript skills

Summary of implementation methods for calling js in js files_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:43:451174browse
Method 1:
Js_file01.js
========
Copy code The code is as follows:

//Program code
document.write("


Js_b.js
=== =====
Copy code The code is as follows:

//Program code
new_element=document.createElement("script");
new_element.setAttribute("type","text/javascript");
new_element.setAttribute("src"," Js_a.js");
document.body.appendChild(new_element);
function fun_b ()
{
Fun_a();
}


Js_a.js
= =======
Copy code The code is as follows:

//Program code
function Fun_a ()
{
alert("a");
}


Method 3:
Js_file01. js
========
Copy code The code is as follows:

//Program code
document.scripts[0].src=" Js_file02.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