Jquery 如果easyui日期框内容放在Iframe中,如何获取它

Jquery 如果easyui日期框内容放在Iframe中,如何获取它,jquery,html,iframe,jquery-easyui,datebox,Jquery,Html,Iframe,Jquery Easyui,Datebox,我尝试使用下面的代码访问Iframe中的easyui日期框内容,但没有成功 alert($("#documentFrame").contents().find("#field6").datebox('getValue'); 其中,#documentFrame是Iframe ID,如果是日期框,#field6ID 使用以下代码可以很好地获取文本框的值 alert($("#documentFrame").contents().find(&

我尝试使用下面的代码访问Iframe中的easyui日期框内容,但没有成功

alert($("#documentFrame").contents().find("#field6").datebox('getValue');
其中,
#documentFrame
是Iframe ID,如果是日期框,
#field6
ID

使用以下代码可以很好地获取文本框的值

alert($("#documentFrame").contents().find("#field2").val());
其中,
#documentFrame
是Iframe ID,如果输入框为


如何获取日期框值?

要完成获取放置在Iframe中的日期框内容的过程,您可以按照以下步骤操作:

您需要在返回日期框值的iframe文档中编写如下函数

代码

function getValue(value){
    var id='#'+value;
    var val= $(id).datebox('getValue');
    return val;
}
从父文档中,您可以调用getValue()方法,并将日期框组件ID作为参数传递给getValue()方法

从Iframe父文档调用getValue()的代码

value = window.frames[0].getValue('field ID');
alert(value);
多谢各位