iframe子页面调用父页面js函数
window.parent.document.getElementById("test").value;
jQuery方法为:
$(window.parent.document).contents().find("test").val();
例:
父:
<div id="page-wrapper" class="gray-bg dashbard-1">
<div class="row J_mainContent" id="content-main" class="tab-content">
<iframe id="J_iframe" width="100%" height="100%" src="index_v1.html" frameborder="0" data-id="index_v1.html" seamless></iframe>
</div>
</div>
子方法:
$('.btn-skip').click(function(){
var url = 'index_v5.html';
$(window.parent.document).contents().find("#J_iframe").attr('src', url);
});