It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Cannot get .focus to work in firefox

Cannot get .focus to work in firefox

Postby siege on Fri Apr 27, 2007 3:05 am

I cannot an existing child window to focus in firfox using the below. This script works fine under Safari and Netscape. Is there a way to make a child window focus in firefox?


Code: Select all
var win=null;
var openedYet=false;
function poppy(mypage,myname,w,h,scroll,pos){
   //alert ("area 0");
   if(!openedYet){
    //alert ("area 1");
      if(pos=="random"){
         LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
         settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
         win=window.open(mypage,myname,settings);
         
         }
      if(pos=="center"){
         LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
         settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
         win=window.open(mypage,myname,settings);
         
         }
      else if((pos!="center" && pos!="random") || pos==null){
         LeftPosition=50;
         TopPosition=50;
          alert ("area 2: Did not specify correct position  or gave no position");
      }
      openedYet=true;
      }else{
       
       if(loaded=="false"){
       LeftPosition=x;
       TopPosition=y;
       //alert("im loaded but needs new win");
       settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
      win=window.open(mypage,myname,settings);
      }else{
      // this focus will not work - why?
      win.focus();
      }
   
   }


}
siege
 
Posts: 31
Joined: Fri Apr 20, 2007 11:03 pm

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 2 guests