“First we have to understand the Parent child relation among multiple windows, from where popup will
Opened that window will always act like a parent for that Popup in case if I further open Popup with in a Popup now old Popup is parent for this new Popup, by using Parent child relationship among window I can do a lot of stuff like what we r going to do now is to when I drag “
Here u will get how far is your parent popup from screen in both directions using this script .
var windowTop = document.all ? window.screenTop : window.screenY;
var windowLeft = document.all ? window.screenLeft : window.screenX;
Now from your Parent Popup target Your child , so we have to make a function.
child = window.open(“smaple.aspx”, “Title”,”location=0,status=0,scrollbars=0,width=400,height=500″);
function dragChild() {
var windowTop = document.all ? window.screenTop : window.screenY;
var windowLeft = document.all ? window.screenLeft : window.screenX;
if (childWin != null) {
childWin.moveTo(PlayerLeft + 400 + 10, PlayerTop + 10);
}
}
Here childWin is a refrence to popup that we create above what we are doing above is that we get screenLeft and screenTop of Parent window and assign it to it’s child window with addition of Parent window width(400) and some margins.
Tricky part : “we have to check parent window Position at every moment and assign it to popup” our final code will be;
<script type=”text/javascrpt”>
childWin = window.open(“smaple.aspx”, “Title”,”location=0,status=0,scrollbars=0,width=400,height=500″);
var timer = setInterval(‘dragchild’,1);
function dragChild() {
var windowTop = document.all ? window.screenTop : window.screenY;
var windowLeft = document.all ? window.screenLeft : window.screenX;
if (childWin != null) {
childWin.moveTo(windowLeft + 400 + 10, windowTop + 10);
}
}
</script>
Be happy coding….