var iframe = document.createElement("<IFRAME id='frame0' style='PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px' border='no' name='frame0' src='RasteriserServlet?width=200&height=200&bgColor=#FFFFFF&fgColor=#000000' frameBorder='no' width='200' scrolling='no' height='200' menuId='formControlPopup' childName='frame' showLable='true' labelPosition='bottom'>");
var form = document.createElement("<FORM action='RasteriserServlet?' name='form0' childName='form' method='Post' id='form0'>");
iframe.appendChild(form);
or
iframe.insertBefore(form);
doesn't works "Unexpected call to method or property access."
So,
how to appendChild to iframes?
Several issues:
To my knowledge, you can't create elements with
var td = document.createElement( "<td id='bla' width='100%'>" );
but with
var td = document.createElement( "td" );
td.setAttribute( "id", "bla" );
td.setAttribute( "width", "100%" );
etc.
Now, I used TD as an illustration, it should of course refer to the
iframes as well. Maybe there's some part of DOM that parses the
strings in the fashion you used them, but I'm not familiar with that.
Second, iframes are actually a form of windows, not DOM nodes, that in
themselves container documentElement and documentElement in its self
contains Elements. So, what you should do is find the iframe's
contentWindow, then its document element, and then you can find the
'body' element of the document; then you can append children to the
latter.
So, what you should probably do is something like this: (not tested,
but just pointing the direction)
var iframe = document.createElement("IFRAME" );
iframe.id = 'frame0';
iframe.setAttribute( "style", 'PADDING-RIGHT: 0px; PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px; PADDING-TOP: 0px'" );
iframe.setAttribute( "border, 'no' );
iframe.setAttribute( "name", 'frame0' );
iframe.setAttribute( "src", 'RasteriserServlet?
width=200&height=200&bgColor=#FFFFFF&fgColor=#000000' );
iframe.setAttribute( "frameBorder", 'no' );
.....
var form = document.createElement( "FORM" );
form.setAttribute( "action", 'RasteriserServlet?' );
form.setAttribute( "name", 'form0' );
.....
iframe.contentWindow.document.body.appendChild( form );
I don't know if this is going to work though, cause just creating the
"iframe" element shouldn't create all of its necessary children I
named above, such as contentWindow, its corresponding document, body,
etc. elements.
So, maybe, the thing you're doing maybe isn't the best idea in the
very root of its concept?