Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用GWT查询获取iframe的内容?_Java_Gwt_Iframe_Gwtquery - Fatal编程技术网

Java 如何使用GWT查询获取iframe的内容?

Java 如何使用GWT查询获取iframe的内容?,java,gwt,iframe,gwtquery,Java,Gwt,Iframe,Gwtquery,我试着这样做: $("iframe.cke_dialog_ui_input_file").contents() 但它的回报是: < #document(gquery, error getting the element string representation: (TypeError) @com.google.gwt.dom.client.DOMImplMozilla::toString(Lcom/google/gwt/dom/client/Element;)([JavaScript

我试着这样做:

$("iframe.cke_dialog_ui_input_file").contents()
但它的回报是:

< #document(gquery, error getting the element string representation: (TypeError) @com.google.gwt.dom.client.DOMImplMozilla::toString(Lcom/google/gwt/dom/client/Element;)([JavaScript object(8570)]): doc is null)/>
<#document(gquery,获取元素字符串表示时出错:(TypeError)@com.google.gwt.dom.client.dominplmozilla::toString(Lcom/google/gwt/dom/client/element;)([JavaScript对象(8570)]:doc为null)/>
但是文档不是空的

请帮我解决这个问题:(

UPD.HTML代码:

<iframe id="cke_107_fileInput" class="cke_dialog_ui_input_file" frameborder="0" src="javascript:void(0)" title="Upload Image" role="presentation" allowtransparency="0">
<html lang="en" dir="ltr">
<head>
<body style="margin: 0; overflow: hidden; background: transparent;">
<form lang="en" action="gui/ckeditor/FileUploadServlet?CKEditor=gwt-uid-7&CKEditorFuncNum=0&langCode=en" dir="ltr" method="POST" enctype="multipart/form-data">
<label id="cke_106_label" style="display:none" for="cke_107_fileInput_input">Upload Image</label>
<input id="cke_107_fileInput_input" type="file" size="38" name="upload" aria-labelledby="cke_106_label">
</form>
<script>
window.parent.CKEDITOR.tools.callFunction(90);window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(91)}
</script>
</body>
</html>
</iframe>

上传图像
window.parent.CKEDITOR.tools.callFunction(90);window.onbeforeunload=function(){window.parent.CKEDITOR.tools.callFunction(91)}
contents()方法返回
HTMLDocument
,因此通常您必须找到
来操作它

$("iframe.cke_dialog_ui_input_file").contents().find("body");
一个常见的错误是在iframe完全加载之前查询它,因此使用
计时器
调度程序
GQuery.delay()
对延迟进行编码。例如:

$("iframe.cke_dialog_ui_input_file")
  .delay(100, 
    lazy()
      .contents().find("body")
        .css("font-name", "verdana")
        .css("font-size", "x-small")
    .done());
contents()
方法返回
HTMLDocument
,因此通常必须找到
来操作它

$("iframe.cke_dialog_ui_input_file").contents().find("body");
一个常见的错误是在iframe完全加载之前查询它,因此使用
计时器
调度程序
GQuery.delay()
对延迟进行编码。例如:

$("iframe.cke_dialog_ui_input_file")
  .delay(100, 
    lazy()
      .contents().find("body")
        .css("font-name", "verdana")
        .css("font-size", "x-small")
    .done());
contents()
方法返回
HTMLDocument
,因此通常必须找到
来操作它

$("iframe.cke_dialog_ui_input_file").contents().find("body");
一个常见的错误是在iframe完全加载之前查询它,因此使用
计时器
调度程序
GQuery.delay()
对延迟进行编码。例如:

$("iframe.cke_dialog_ui_input_file")
  .delay(100, 
    lazy()
      .contents().find("body")
        .css("font-name", "verdana")
        .css("font-size", "x-small")
    .done());
contents()
方法返回
HTMLDocument
,因此通常必须找到
来操作它

$("iframe.cke_dialog_ui_input_file").contents().find("body");
一个常见的错误是在iframe完全加载之前查询它,因此使用
计时器
调度程序
GQuery.delay()
对延迟进行编码。例如:

$("iframe.cke_dialog_ui_input_file")
  .delay(100, 
    lazy()
      .contents().find("body")
        .css("font-name", "verdana")
        .css("font-size", "x-small")
    .done());

首先像您现有的cod一样使用javascript获取iframe元素,并将其存储到GWT的iframe中

IFrameElement iframe = (IFrameElement) element;
现在使用iframe获取内容

iframe.getContentDocument().getBody().getInnerText();

希望它能帮助您获取值。

首先使用javascript获取iframe元素,就像您现有的cod一样,并将其存储到GWT的iframe中。

IFrameElement iframe = (IFrameElement) element;
现在使用iframe获取内容

iframe.getContentDocument().getBody().getInnerText();

希望它能帮助您获取值。

首先使用javascript获取iframe元素,就像您现有的cod一样,并将其存储到GWT的iframe中。

IFrameElement iframe = (IFrameElement) element;
现在使用iframe获取内容

iframe.getContentDocument().getBody().getInnerText();

希望它能帮助您获取值。

首先使用javascript获取iframe元素,就像您现有的cod一样,并将其存储到GWT的iframe中。

IFrameElement iframe = (IFrameElement) element;
现在使用iframe获取内容

iframe.getContentDocument().getBody().getInnerText();

希望它能帮助您获取值。

您能共享您的代码吗?您是否使用UiBinder?如果是,则在视图中呈现元素之前,您无法访问这些元素。否则,您必须使用@UiField IFrameElement IFrameElement。然后使用$(IFrameElement)。contents()。我遇到了这个问题。你能分享你的代码吗?你在使用UiBinder吗?如果是,在视图中呈现元素之前,你不能访问它们。否则,你必须使用@UiField IFrameElement IFrameElement。然后使用$(IFrameElement)。contents()。我遇到了这个问题。你能分享你的代码吗?你在使用UiBinder吗?如果是,在视图中呈现元素之前,你不能访问它们。否则,你必须使用@UiField IFrameElement IFrameElement。然后使用$(IFrameElement)。contents()。我遇到了这个问题。你能分享你的代码吗?你在使用UiBinder吗?如果是这样,在视图中呈现元素之前,你无法访问元素。否则,你必须使用@UiField IFrameElement IFrameElement。然后使用$(IFrameElement).contents()。我遇到了这个问题。