Alan Hecht

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAlan Hecht
ToMe
SubjectPassing frame name to find-in-page script
Date7 July 2004 14:45
Great script (find-in-page)!  Just what I think I'm looking for.

My question is simple (I hope).  I'm trying to have the search form field in a
banner frame and the content to search in a lower frame called "main."

How do I properly pass the value of the "main" frame object to the searchForText
function?

The call line in your script reads as follows:

   onSubmit="searchForText( this.elements[0].value, window )"

What do I change the 'window' parameter to in order to have the script search the
lower "main" frame?

I tried:

 onSubmit="searchForText( this.elements[0].value, top.main )

and it seems to work.  Let me know if you have a better solution.

Thanks in advance?

~Alan Hecht
FromMe
ToAlan Hecht
SubjectRe: Passing frame name to find-in-page script
Date8 July 2004 08:56
Alan,

You got it right.

You will encounter problems if your page is held inside someone else's
frameset (if that really matters). Using 'parent' instead of 'top' would
fix this, assuming that the frames share the same parent page. You could
also have used the full syntax, but that would have been longer, and is not
neccessary:
window.parent.frames['main']


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromAlan Hecht
ToMe
SubjectRe: Passing frame name to find-in-page script
Date8 July 2004 12:57
Thanks!  That extra info did help.

Again, you've got some really great scripts on your site.

~Alan
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.