标签:var func lang index esc lin dex param script
/**
* 直接使用
*/
var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
scripts[i].parentNode.removeChild(scripts[i]);
}
/**
* 删除 script 文件
* @param src
*/
function removeScript(src) {
var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
if (scripts[i] && scripts[i].src && scripts[i].src.indexOf(src) != -1) {
scripts[i].parentNode.removeChild(scripts[i]);
}
}
}
/**
* 删除 link 文件
* @param href
*/
function removeCss(href) {
var links = document.getElementsByTagName("link");
for (var i = 0; i < links.length; i++) {
var _href = links[i].href;
if (links[i] && links[i].href && links[i].href.indexOf(href) != -1) {
links[i].parentNode.removeChild(links[i]);
}
}
}
标签:var func lang index esc lin dex param script
原文地址:https://www.cnblogs.com/amize/p/14338311.html