View Full Version : Actions based off of specific pages (in frames)

07-19-2007, 07:01 AM
Ok this is a complicated one but I'll try my best to explain it. I have a framset document; one of the frames contains timers which I would like to have reset when another frame (the "main" frame) visits a certain page. The timer reset code is
javascript:maReset(1) but I know I will need to add to that.

07-19-2007, 10:54 AM
I think you'll need to periodically check the location.href of the "main" frame then when you get a match you can reset the timer.

To reference the "main" frame you'll have to use something like:


If the "certain page" that triggers the reset is one of yours you can reset the timer in another frame from that page. You have to reference the timer correctly though.
For example if your frame the timer exists in is called "timerFrame" and the timer reference is called "timer" you could put the following in a function that runs onload (also assuming you're using setTimeout to start the timer not setInterval otherwise you'd need clearInterval instead of clearTimeout):


07-19-2007, 08:14 PM
If the page in the main frame is not in the same domain as yours, then you can't access that frame eventhough you only want to get the url.

07-19-2007, 11:06 PM
The page in the "main" frame is not mine so I cant put any code on it. glenngv are you saying then that this wont work at all or will I be able to use the
parent.main.location.href as mcjwb said?