Email conversation
From | Alan Hecht |
To | Me |
Subject | Passing frame name to find-in-page script |
Date | 7 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
From | Me |
To | Alan Hecht |
Subject | Re: Passing frame name to find-in-page script |
Date | 8 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/
From | Alan Hecht |
To | Me |
Subject | Re: Passing frame name to find-in-page script |
Date | 8 July 2004 12:57 |
Thanks! That extra info did help.
Again, you've got some really great scripts on your site.
~Alan