JavaScript
- 7 ответов
- 0 вопросов
4
Вклад в тег
db.collection.find({'response.type':'text'}})
function change(oldFileName, fileName) {
// fileName, oldFileName
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length; i--;) {
if (scripts[i] && scripts[i].getAttribute('src')!=null && scripts[i].getAttribute('src').indexOf(oldFileName)!=-1){
console.log('found!');
var newScript = document.createElement('script');
newScript.setAttribute("type","text/javascript");
newScript.setAttribute("src", fileName);
scripts[i].parentNode.replaceChild(newScript, scripts[i]);
}
}
}
<script type="text/javascript" src="/old.js"></script>
<script type="text/javascript" src="/new.js"></script>