function pvc() { var ref; if (parent.frames.length > 0) ref = parent.document.referrer; else ref = document.referrer; var img_src = "https://track.affiliate-b.com/start_1.php?" + "ref="+ref+"&adv=r1109D"; // alert(document.referrer); document.write(''); } window.onload = new Function(pvc());