window focus

  • Thread starter Thread starter Wei
  • Start date Start date
W

Wei

I need the current window stay on focus. The user will have to click on exit
button to exit the window. How can I do this in asp.net in C#?
Thank you
 
How can I do this in asp.net in C#?

You can't. However, you CAN do it in HTML with JavaScript:

window.onblur = window.focus();

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
This will help me solve the problem.
Thanks

Kevin Spencer said:
You can't. However, you CAN do it in HTML with JavaScript:

window.onblur = window.focus();

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Hi,
I call a JAVA function at page load and I got an error message: "not
implemented".
Here is my code:

<body onload=try()>
JAVA script function:
function try() { window.onblur = window.focus(); }

Also I tried in .cs file:
private void Page_Load(object sender, System.EventArgs e)

{

Response.Write("<script>window.onblur = window.focus();</script>");

}

I got the same error message.

Thanks for your help
 
Hi Wei,

Yeah, sorry about that. Add the onblur event handler to the body instead of
the window:

<body onblur="window.focus()">

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
One other note: This may or may not work, depending upon the settings of the
OS. The browser will request focus from the OS, but it may not get it. You
will see the browser icon on the task bar get the focus, though, even if the
window doesn't. Not much you can do about that.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Back
Top