Forum Moderators: open
function initEditor(){
document.frames('myEditor').tbContentElement.DOM.body.innerHTML = document.frmInsert.txtBody.value;
}
Somehow this does not work, but when I add an alert function before, then it works:
function initEditor(){
alert()
document.frames('myEditor').tbContentElement.DOM.body.innerHTML = document.frmInsert.txtBody.value;
}
Can anybody explain this to me?
thanx
Pete
and as long as those elements you are interested in have id's and/or names, you can use them. for example (im not 100% this is right)
for instance, this is how your tags might look, whereever they are:
<input type='text' id='grabThisText'>
<frame name='leftFrame'>
and in your onload function, this would be it,
document.getElementByName("leftFrame").innerHTML = document.getElementByID("grabThisText").value
now one thing: i am not going to lie to you: i never use javascript for forms, so that last part could be wrong...
It could be that your JavaScript is trying to write content before the IFrame has been set up correctly.
Putting the Alert box before the copy makes the JavaScript engine wait for the user to acknowledge - which gives the IFrame time to set up.
You could try moving the copy line to the end of the document - see if that has any effect. Either that, or
add a pause or checking routine in somewhere.
HTH,
JP