Pages

Tuesday, June 5, 2012

acessing the parent elements on child page

function assign_value(vname, vid)
{
window.opener.document.getElementById('P2_VENDOR_NAME').value = vname;
window.opener.document.getElementById('P2_VENDOR_ID').value = vid;
window.opener.document.getElementById('P2_X').value = vid;


window.opener.document.getElementById('P2_VENDOR_NAME').focus();
window.opener.doSubmit('LOAD_HEADER');

window.close();

}


callinng popup from the parent page
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,location=0,statusbar=0,menubar=0,scrollbars=1');");
}

2 comments:

  1. Just to add, $x an $v can also be used as "short-hand" methods. So in above example we can replace,

    window.opener.document.getElementById('P2_VENDOR_NAME').value = vname;
    window.opener.document.getElementById('P2_VENDOR_ID').value = vid;
    window.opener.document.getElementById('P2_X').value = vid;

    WITH

    window.opener.document.$x('P2_VENDOR_NAME').value = vname;
    window.opener.document.$x('P2_VENDOR_ID').value = vid;
    window.opener.document.$x('P2_X').value = vid;

    ReplyDelete
  2. Hey AI,

    Thats nice . I used $x but not in this senario.

    Thanks for making it more easier .

    Regards,
    Nandini Thakur

    ReplyDelete