PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Nov 27, 2014 7:10 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jan 29, 2006 10:04 pm 
Offline
DevNet Resident
User avatar

Joined: Thu Jan 13, 2005 7:44 pm
Posts: 2341
Location: Sarasota Florida
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.

Syntax: [ Download ] [ Hide ]
//<![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;
}
////]]>


John


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 29, 2006 10:19 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
Syntax: [ Download ] [ Hide ]
if( typeof parent == 'object' ) {
  if( typeof parent.border != 'undefined' ) {
    parent.frames['border'].location = //
  }
}



maybe?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 29, 2006 10:24 pm 
Offline
DevNet Resident
User avatar

Joined: Thu Jan 13, 2005 7:44 pm
Posts: 2341
Location: Sarasota Florida
No, that is referencing something and in that case we now do not even check to see if that object (parent.border) exists in the first place.

I've tried setting up my script as so...

if the parent.border exists {}

Does not seem to work however as the script still attempts to execute even if the page is in no frame.

John


Top
 Profile  
 
 Post subject: Script Solved!
PostPosted: Mon Jan 30, 2006 1:17 am 
Offline
DevNet Resident
User avatar

Joined: Thu Jan 13, 2005 7:44 pm
Posts: 2341
Location: Sarasota Florida
I have solved the issue...

To add detection to a script to execute only when a condition is met I used this...
Quote:
if (parent.border)
{
}


I left out detecting if the object did not exist and exported it externally, and it worked! For others to reference in the future!

Quote:
//<![CDATA[
if (parent.border)
{
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';
}
}
////]]>


John


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group