Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created March 25, 2011 01:48
Show Gist options
  • Save igaiga/886222 to your computer and use it in GitHub Desktop.
Save igaiga/886222 to your computer and use it in GitHub Desktop.
javascriptタグを1回だけ読み込み
requireFileOnce = function( checkType, js_name ){
if(typeof(checkType) == 'undefined'){
if( typeof(js_name) == 'string'){
document.write('<script type="text/javascript" src="/javascripts/' + js_name + '.js"></script>');
}else{
for( var i=0; i<js_name.length; i++ ){
document.write('<script type="text/javascript" src="/javascripts/' + js_name[i] + '.js"></script>');
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment