Kamis, November 24, 2011

Javascript : Reload Target / Parent Window From Second Child Window

I have problem like this guy on this link.

Solution : use window.name, and target it to reload

On parent page :
window.name = "parent_window";

On the first child page :
function open2print(id_cek_in,diskon) {
 window.open( "cek_print.php?id_cek_in="+id_cek_in+"&cetak=y&diskon="+diskon, "print","status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=800" )

On the second child page :
function reloadWin(){
 var parent_window = window.open("", "parent_window");

<body onload=reloadWin();>

So when the second child window load, it will be reload parent window.

Source : http://www.codingforums.com/showthread.php?t=113902

PS : I hate javascript, too many parents and children involved :(