Results 1 to 6 of 6

Thread: Anyone have a good script for keeping a child window focused?

  1. #1

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057

    Anyone have a good script for keeping a child window focused?

    I need to open a new window and have the user finish with that window before going back to the parent. I tried the showModalDialog approach but it has too many problems. I used to have a script that would do wwhat I wanted but it dosen't seem to be working:

    the parent's code:
    Code:
    var taiWin=0
    
    function openchildwindow() {
    	var intWidth = document.body.offsetWidth / 2 - 225;
    	var intHeight = document.body.offsetHeight / 2 - 200;
    	taiWin=	window.open("test.asp","TAI")
    } 
    function keepchildontop(){
    	if(taiWin){
    	taiWin.Focus();
    	}
    }
    and in the parent's body tag
    Code:
    <BODY BGCOLOR="#<%= Session("BGColor") %>" TOPMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" onFocus="keepchildontop()">
    but that isnt working. Any suggestions?
    Thanks in advance,
    Michael

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    can't you do,

    <body onBlur="document.focus();">

    something like that, i never tried so give it a shot!

  3. #3

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    So, simplistic, so obvious, so perfect. I don't know why I wanted to make it so hard for myself
    Thanks!
    Michael

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    cool, i'm glad it worked!

    one thing, does it let you go to a text box or click on a button!!

  5. #5

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    you had me scared for a sec but it looks like it does

  6. #6
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    cool, sorry for the scaring part!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width