Problems manipulating child windows after location changed

Discussion in 'JavaScript' started by dcorbett, Mar 22, 2010.

  1. #1
    Problems manipulating child windows. I can open a child window and move it around etc without problem as long as it is a page I created - but when I change the url of the child to "Google.co.uk" any attempt to manipulate it crashes my parent window. Anybody help? Currently using IE6. Here is some sample code:
    <HTML>
    <HEAD>
    <!---- open window --->
    <script language="JavaScript">
    var evilChild = window.open("Default.html", "", "height=300, width=300,resize=0");
    function moveit()
    {
    evilChild.moveTo(10,0);
    }
    function redit()
    {
    evilChild.document.bgColor='#ff0000';
    }
    function google()
    {
    evilChild.location.href = "http://www.google.co.uk";
    }
    </script>
    <BODY>
    <A Href="" onClick="moveit();return false">Move it!</a>
    <BR>
    <A Href="" onClick="redit();return false">Change it to red!</a>
    <BR>
    <A Href="" onClick="google();return false">Google it!</a>
    </html>
     
    dcorbett, Mar 22, 2010 IP