Check if external Javacript file is loaded

Load a Javascript external file if it dosen´t loaded yet.

This function will check if there is a script tag with the external file required. If the tag is allready in de document will skip the document write.

function loadScript(src) {
  for(var i = 0; i < scripts.length; i ++) {
    if(scripts[i].src == src) {
  var script = document.createElement('script');
  script.setAttribute('src', src);

Call this function to insert the script to the document.


Scroll the page to element

Scroll the web window to a especific element of the dom document in a Javascript action. The code will refer the element by his id and push a margin to take better position. [ read ]