[Javascript] javascript and frames...

Ben Curtis Quixote at LaMancha.org
Mon Jun 25 17:17:46 CDT 2001


> onClick="parent.frames[2].location='javascript:location.reload()'"
> 
> But it will not work whe I try to reload the frame containing the link
> (frames[0])


Some browsers won't let you set the location or location.href property
within an onclick event handler for a link. I'm not sure why -- perhaps to
avoid tricking users with something like this:

<a href="http://kids.disney.com"
  onclick="self.location='http://porn-o-rama.com';">Safe for kids!</a>

So, your problem lies in the technique you are using. The correct format for
doing what you are doing is:

onClick="parent.frames[2].location.reload()"

...and so therefore:

onClick="parent.frames[0].location.reload()"

(but that should be the same as onClick="self.location.reload()" in this
case, right?)

+Ben Curtis
...established 1971.











More information about the Javascript mailing list