父子页面的相互调用

来源:互联网 发布:1.76我本沉默复古淘宝 编辑:程序博客网 时间:2024/04/28 10:50
DOM方法:父窗口操作IFRAME:window.frames["iframeSon"].document
IFRAME操作父窗口: window.parent.document
jquery方法:
在父窗口中操作 选中IFRAME中的所有输入框: $(window.frames["iframeSon"].document).find(":text");
在IFRAME中操作 选中父窗口中的所有输入框:$(window.parent.document).find(":text");
iframe框架的HTML:<iframe src="test.html" id="iframeSon" width="700″ height="300″ frameborder="0″ scrolling="auto"</iframe
1.在父窗口中操作 选中IFRAME中的所有单选钮
$(window.frames["iframe1"].document).find("input[@type='radio']").attr("checked","true");
2.在IFRAME中操作 选中父窗口中的所有单选钮
$(window.parent.document).find("input[@type='radio']").attr("checked","true");


ps:  $(function(){
   var dialog = top.dialog.get(window);
   $("#remove-dialog").click(function(){
   var pageNum =  window.parent.document.getElementById("page").value;
   var win=window;
   win=window.parent;
   win.goPage(pageNum);
   dialog.close().remove();
   })
 });


$.ajax({
                url:"/resource/inventory/batchSetItemsByMemberId.jsp",
                data:params,
                type:"post",
                dataType:"json",
                contentType:"application/x-www-form-urlencoded;charset=GBK",
                success:function(message){
                    if(message["result"]=="success"){
                         $(window.frames["batch_message_pop"].document).find("#batchdeal").text("恭喜你,批量定量已完成!!");
                         $(window.frames["batch_message_pop"].document).find("#batchsuc").css("display","");

                    }else{
                        batpub.remove();
                        alert(message["message"]);
                        return;
                    }
                },
                error:function(){
                    batpub.remove();
                    alert("程序发生错误,请联系管理员!");
                },
                beforeSend:function(){
                sendMessage();
            }
            });

1 0
原创粉丝点击