I have this simple line
alert(window.parent.frames[0].document.getElementById(\'textToSearch\').value);
I have 2 frames, first with a text
Use contentWindow.document instead of document:
contentWindow.document
document
var frame = window.parent.frames[0].contentWindow; alert(frame.document.getElementById('textToSearch').value);
You can also just use contentDocument for most browsers, but not Internet Explorer 7 or older.
contentDocument