0
如何读取用户从iframe输入的表单数据?从iframe读取表单数据
没有的iframe,我会做这样的事情:
jQuery的:
function getRowData(id, parent){
var data = [];
$(parent+' table tr').each(function(){
var row = {};
$(this).find('select, input, textarea').each(function(){
if(($(this).attr('id') == id) && (typeof $(this).attr('name') !== 'undefined' && $(this).attr('name') !== false)){
row['id'] = id;
row[$(this).attr('name')] = $(this).val();
}
});
data.push(row);
});
return data;
}
和HTML:
<table id="form-table">
<td><input type="checkbox" name="n_available" checked="checked"></td>
<td><input type="checkbox" name="n_oem" checked="checked"></td>
</table>
,并调用了jQuery:
$('.get-data').live('click', function() {
postData = $(this).attr("id");
getRowData("form-table", $(this).attr("id");//here i have my form in an array...
});
现在,如果html i在iframe中,我如何获取数据?
iframe页面是否来自同一个域? – Chris
是的,它来自同一个域 – tom91136