父页面上取<iframe>内容元素

<!-- 查询客户信息 modal -->
    <div id="searchCusDiv" class="modal fade newadd" tabindex="-1"
         role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">查询客户信息</h4>
                </div>
                <div class="modal-body">
                    <iframe id="CustomerForOrderInFo" src="" frameborder=0 framespacing=0
                            width="100%" scrolling="auto" height="600px" style="display: none"></iframe>
                </div>
                <div class="modal-footer">
                    <button id='searchCus_add' type="button" class="btn btn-primary">确认</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>

这里写图片描述

整个内容为一个模态框,<iframe>对应的内容蓝框包裹的内容

父页面取<iframe>里的内容

<input type='radio' dataId='" + data + "' class='idCheckbox' name='cus_id_checked' id='table_list_checkbox' />"

JS代码获取input内容

var selectedRows = $('#CustomerForOrderInFo').contents().find("input:radio[name='cus_id_checked']:checked");//CustomerForOrderInFo为iframe的id

if (selectedRows.length > 1) {
        system.alert("只能选择一个客户 ");
} else {
    var khId = selectedRows.attr("dataId");

其他调用问题请看

jQuery 父iframe与子iframe 相互调用传值:http://blog.csdn.net/wd4871/article/details/50517597

猜你喜欢

转载自blog.csdn.net/peng_hong_fu/article/details/77719623
今日推荐