Need help stopping script from executing when not in frames!
Posted: Sun Jan 29, 2006 9:04 pm
If you test this script out it will create an error in Firefox after four clicks on the page that "parent.border" has no properties. This means I've failed to keep the script from executing when the page is not in a frame. So I just need to make the script only execute if it is inside of frames and do absolutely nothing if the page is not in frames.
John
Code: Select all
//<![CDATA[
if (top.location!=self.location)
{
var clickCount = 0;
var clickSpacing = 4;
var clickCycle = 22;
document.onclick = function()
{
clickCount = ++clickCount % clickCycle // if 22, return to zero
if(clickCount &&!(clickCount % clickSpacing)) // if clickCount is non-zero multiple of clickSpacing
parent.border.location
= 'http://example.com/border'
+ (clickCount/clickSpacing)
+ '.php';
}
}
else if (top.location==self.location)
{
return false;
}
////]]>