I have a html with an iframe redirecting to another page, this is a game that i'm doing in text mode.

And some scripts of the game are going to be edited soon, so im trying to do a JS function that writes some few changes in the iframe.
It would be something like:

<iframe name="lyly" id="lyly" ...></iframe>

then something like:

document.lyly.write("<script> the current code that will run there</script>");

Is that possible?
This way i wont need to use PHP to do sometricks and will save a lot of $.