Passing data between a parent window and a child popup window with jQuery

前端 未结 3 1058
滥情空心
滥情空心 2020-12-15 07:49

I have the following HTML


    
        Affiliate Party
    
    
            


        
3条回答
  •  太阳男子
    2020-12-15 08:09

    Have a look at this instructional article: http://www.plus2net.com/javascript_tutorial/window-child3.php

    Essentially, you need to do this in the child window's form. You'll be passing a value like so:

    opener.document.f1.p_name.value="Any value";
    

    Where f1 is the ID of the form in the parent window and p_name is the name of the field in the form.

    Once you have the value in a field on the parent, you can do whatever you like with it.

    EDIT:

    To pass info to the child window, the easiest method would probably be via query string, and then read the query string from the child window. In this case, probably something like:

    $(".PartyLookupToggle").click(function () {
        window.open("PartySearch.aspx?id=" + $(this).prev().attr('id'), "PartySearch", "width=400,height=50");
        return false;
    });
    

提交回复
热议问题