Hi,

I have used the following script in a no-frame document to replace text of a specified span (id=element142) with no problems.

Code:
function GenerateCode()
{
 r=document.body.createTextRange();
 r.moveToElementText(element142);
 r.text="Newly generated text"
}
However, I have a page with an iframe, and the iframe has two frames within itself. I am using a modified version of the previous function in the parent frame to replace the text of a span in the frame inside the iframe. All I did was add the name of the iframe and the name of the second frame (myEditor.page) to the r variable to specify that the element is not in the parent document, but is two frames deeper....

Code:
function GenerateCode()
{
 r=myEditor.page.document.body.createTextRange();
 r.moveToElementText(element142);
 r.text="Newly generated text"
}
This causes an 'element142' is undefined error, even though there is a span in that frame with that id. What am I doing wrong?

Thanks in advance,
David