Running JavaScript commands from the console command line is incredibly useful, but if you have an iframe to contend with it can be a problem if you don't know how to target your frame.

In Firebug, you can use the following command to focus on the frame in question and execute your commands against:

cd(window.frames['frameName']);

Chrome allows you to change frame from a dropdown list found at the bottom of the console window.

Opera has a dropdown for changing frame which is available from the “Console” and “Documents” tab. The dropdown will only appear on the “Console” tab if there are frames to select.

You can also get a list of any iframes on your page by using document.getElementsByTagName("iframe"); in the console.