i want to create an iframe using javascript and add the returned object from javascript to a simplePanel
i create iframe using this method :
public static native JavaScriptObject createIframe(String frameId)/*-{enter code here
if($wnd.frames[frameId]!=null){
var iframes = $doc.getElementsByTagName(frameId);
for (var i = 0; i < iframes.length; i++) {
iframes[i].parentNode.removeChild(iframes[i]);
}
}
ifrm = $doc.createElement("IFRAME");
ifrm.setAttribute("id", frameId);
return ifrm;
}-*/;
and use it in this manner:
public void createIFrame() {
SimplePanel frameContainer = new SimplePanel();
IFrameElement frame= createIframe(FRAME_ID).cast();
frame.setId(FRAME_ID);
frameContainer.clear();
frameContainer.setWidth("100%");
frameContainer.setHeight("100%");
//add frame to frameContainer
}
now ,how can I add frame to frameContainer
You can use:
frameContainer.getElement().appendChild(frame);