i understand from you comment on my persevios answer you want to writer this code :
var headtg = document.getElementsByTagName('head')[0];
var divElm = document.createElement('div');
var scpt = document.createElement('script');
scpt.type = 'text/javascript';
var clName= "TEST";
divElm.className = "ABC_" + clName; divElm.appendChild(scpt);
headtg.appendChild(divElm);
function innercode(i) {
var a = i; var b = a;
}
function (d) {
//codes }(document));
}
if it is true you can write like this :
i hope it will work.let me know