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 :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" charset="utf-8" >
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));
}
</script>
</head>
<body>
</body>
</html>
i hope it will work.let me know