I am getting error only in IE7 as document.body is null, wehn i debug Microsoft script editor getting error in follwing line: ie
document.body.appendChild(i) code:
function nm_eraseCookie(name){
nm_createCookie(name,"",-1)
}
var i=document.createElement('IMG');
i.src='//e.netmng.com/pixel/?aid=403';
i.width=1;
i.height=1;
document.body.appendChild(i);
nm_createCookie('nm_belgacom_bt',
escape('tv1=bun_intvtel;tv2=;tv3=;phone1=hbs_discoveryline;phone2=hbs_classical_line;phone3=;inet1=bun_nettvmob;inet2=hbs_adsl_res_plus;inet3=hbs_adsl_res_go;nm_banner=;nm_popin=hbs_discoveryline;'),183);
Can you infomr me what i need to do to solve this issue.
You could try
Now that won't do you any good if the code is running in the
<head>
, and running before the<body>
has even been seen by the browser. If you don't want to mess with "onload" handlers, try moving your<script>
block to the very end of the document instead of the<head>
.I know it is not with just plain js, but I had a similar issue and I used jquery. I just put all of my code inside a document ready() function
I hope it helps
It is working. Just modify to null check:
Pointy's suggestion is good; it may work, but I didn't try.