首先,你必须知道所有的窗口
其次,可以利用objWindow.document.title属性来进查找!

解决方案 »

  1.   

    <script>
    var aa=new Array();
    aa[0]=window.open("动画.htm","","top=200,width=200,height=200")
    aa[1]=window.open("动画2.htm","","top=200,width=200,height=200")
    function test(){
    for(var i=0;i<aa.length;i++){
    if("xxx"==(aa[i].document.title))
    aa[i].focus();}
    }
    </script>
    <input type=button onclick="test()" value="找窗口"><br>
    动画.htm
    =================
    <head>
    <title>xxx</title>
    <script>
    var tmId;
    function moveit(){
    if((parseInt(document.all.mxh.style.left))>300)
    {
    document.all.mxh.style.left="0";
    document.all.mxh.style.top="0";
    }
    else
    {
    document.all.mxh.style.left=(parseInt(document.all.mxh.style.left)+3).toString()+"px"
    document.all.mxh.style.top=(parseInt(document.all.mxh.style.top)+3).toString()+"px"
    }
    tmId=setTimeout('moveit()',20)
    }</script>
    </head>
    <body onload="moveit()" bgcolor="#0099ff">
    <div id=mxh style="position:absolute;left:0px;top:0px"><a href="http://lucky.myrice.com" target="_blank"><img src="http://lucky.myrice.com/javabk1.jpg" onmouseover="window.clearTimeout(tmId)" onmouseout="window.setTimeout('moveit()',20)" border=0></a></div>
    动画2.htm
    ===============
    <head>
    <title>bbb</title>
    <script>
    var tmId;
    function moveit(){
    if((parseInt(document.all.mxh.style.left))>300)
    {
    document.all.mxh.style.left="0";
    document.all.mxh.style.top="0";
    }
    else
    {
    document.all.mxh.style.left=(parseInt(document.all.mxh.style.left)+3).toString()+"px"
    document.all.mxh.style.top=(parseInt(document.all.mxh.style.top)+3).toString()+"px"
    }
    tmId=setTimeout('moveit()',20)
    }</script>
    </head>
    <body onload="moveit()" bgcolor="#0099ff">
    <div id=mxh style="position:absolute;left:0px;top:0px"><a href="http://lucky.myrice.com" target="_blank"><img src="http://lucky.myrice.com/javabk1.jpg" onmouseover="window.clearTimeout(tmId)" onmouseout="window.setTimeout('moveit()',20)" border=0></a></div>