PDA

View Full Version : Can you improve upon this javascript?



Miles_Baker
01 Nov 2006, 10:04 PM
I am using this javascript code for redirecting and cloaking affiliate links. Just wondering if anyone had any suggestions or tips to make it better. It seems to do the job and set the affiliate tracking cookie.

I know a few basics of javascript, but I am trying to learn. Can someone clarify what's happening in this script exactly? I understand the frame and onload parts, but the OnT and OnT2, what is that doing?

Thanks everyone!



<html>
<head>
<title>My Big Title</title>
<script language="JavaScript">

var Test = null;

function SymError()
{
return true;
}

function OnT()
{
window.status = "Blah Blah Blah";
}

function OnT2()
{
if (Test != null) {
clearInterval(Test);
}
}


window.onerror = SymError;
Test = setInterval("OnT()", 100);

</script>
</head>
<FRAMESET border=0 frameSpacing=0 rows=* frameBorder=0 marginbottom=0 marginright=0 margintop=0 marginleft=0>
<FRAME border=0 src="http://www.myaffiliatelink.com?affiliate" frameBorder=no noResize OnLoad="OnT2()" id="frmMai" name="a">
<noframes>
<body onload='document.location="http://www.myaffiliatelink.com?affiliate; OnT();"'>
</body>
</noframes>
<script language="JavaScript" type="text/javascript">
OnT();
</script>
</html>