Assuming you are calling your function at some point, the following different techniques will work:
Although, I only tested in Firefox. By the way, I wasn't sure about this approach so I spent 5 minutes googling and found the answer for you. The internet is littered with thousands of sites showing how to access frames and documents and forms. Where did you look?