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