iframe java javascript selenium testing

How do you use Selenium to execute javascript within a frame?

I have a page (index.html) which has a frame:

<iframe src="" />

And the otherPage.html has the contents:

<head><link src="" type="text/javascript" /></head>
<body><div id="main">Contents</div></body>

I am attempting to use the following selenium code on index.html:"index.html");

However this fails miserably. It says that the jQuery object doesn’t exist.

If I attempt to execute the selenium test on the otherPage like so:"");

everything is hunky dory.

Right now this is pseudo code, if people want me to make it compile I’ll do that and put it on github.