473,425 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

focus problem in showModalDialog

I have this window where I open a modal dialog window using the code:

newwin=window.showModalDialog(url, "popup", features)

where features are
dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogWidth:" +w+"px;dialogHeight:"+h+"p
x;center:0"

In the window that opens I call a function - setVar() in the body onLoad
event.

The setVar() function contains the following code:

this.form.Name.focus();
this.form.Name.select();

but although the window seem to have focus, I cannot see the cursor in the
form.Name textbox, and if I try to type something nothing happens. If I do a
Alt-tab back to the other window and then back again to the modal window,
the cursor is blinking in the Name field and I can type as normal. What is
causing this behaviour, and what can I do to fix it?

Can anyone please help with this?

Thanks!
iv**@tda.no

Windows XP SP1 IE6 SP2
Jul 23 '05 #1
2 6702
Hello,

I am using Windows XP SP1 IE 6 - but not SP2.
First of all: You don't need the select() function in order to set the
focus; focus() should be enough.
Second: I have tried the following example - according to your description -
and it works correctly.
The focus is in the text field and you can type any characters within it.
page1.html
---------------------------
<html>
<head>
<title>Page 1</title>
<script language="JavaScript">
function func() {
newwin=window.showModalDialog("page2.html", "popup",
"dialogLeft:50px;dialogTop:50px;dialogWidth:300px; dialogHeight:200px;center:
0");
}
</script>
</head>
<body>
<form>
<input type="button" value="please click" onClick="javascript:func()">
</form>
</body>
</html>
page2.html
---------------------------
<html>
<head>
<title>Page 2</title>
<script language="JavaScript">
function setVar() {
document.forms[0].Name.focus();
}
</script>
</head>
<body onload="javascript:setVar()">
<form>
<input type="text" name="Name" value="">
</form>
</body>
</html>
Maybe you want to try this. Hope this helps you.

Nice greetings from
Thomas
Jul 23 '05 #2
Hi!

I did sort'of know about the superfluous select(). I know focus() should be
enough. I just was a bit surprised that it didn't work.

But I found the problem causing this behavioiur. Strange noone else here
knew about it, but perhaps I gave a little sparse information to deduct that
this was the problem.

The problem is the somewhat faulty Sun java-plug in 1.4.1 which causes this
strange behaviour. Sun knows about this according to my sources, but
apparently don't bother to do anything about it. Swithching back to the MS
Java engine fixed the problem.

Thanks for your kind help! Your tip is duly noted ;-)

Brgds
Iver in Oslo

"Thomas Hoheneder" <th**************@gmx.de> skrev i melding
news:ck**********@domitilla.aioe.org...
Hello,

I am using Windows XP SP1 IE 6 - but not SP2.
First of all: You don't need the select() function in order to set the
focus; focus() should be enough.
Second: I have tried the following example - according to your description - and it works correctly.
The focus is in the text field and you can type any characters within it.
page1.html
---------------------------
<html>
<head>
<title>Page 1</title>
<script language="JavaScript">
function func() {
newwin=window.showModalDialog("page2.html", "popup",
"dialogLeft:50px;dialogTop:50px;dialogWidth:300px; dialogHeight:200px;center: 0");
}
</script>
</head>
<body>
<form>
<input type="button" value="please click" onClick="javascript:func()">
</form>
</body>
</html>
page2.html
---------------------------
<html>
<head>
<title>Page 2</title>
<script language="JavaScript">
function setVar() {
document.forms[0].Name.focus();
}
</script>
</head>
<body onload="javascript:setVar()">
<form>
<input type="text" name="Name" value="">
</form>
</body>
</html>
Maybe you want to try this. Hope this helps you.

Nice greetings from
Thomas

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: George Fernett | last post by:
Hi all, I have a page that lists codes and when a code is clicked on, I wanted to show the full text description for the code. Response.Write("<td nowrap>" & "<a...
2
by: Moist | last post by:
Hi, first I must admit this is one of the most active group I have ever seen. For my question: is it possible to create a small popup window that remain in focus until it is closed. That is,...
10
by: CyberBless | last post by:
I have a page that opens a child window using window.open(...). How do I make so that when that child window opens you cannot get the focus back on the parent window unless you close the child...
2
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
4
by: MW de Jager | last post by:
I want to call ShowModalDialog(...) from my C# code in the code behind page of my aspx page. I do not want to link this to a button, since I want to first do some checking myself before I call the...
2
by: Namespace | last post by:
Hi I am having a problem with opening a new browser window through a client-side javascript (window.open/_blank) function. The window do "pop up" but behind the window where I pushed the "pop...
3
by: johkar | last post by:
Just want a verification of logic. This seems to work for IE and Firefox, but I wonder if it would be a problematic test in any of the other latest browsers? Is the use of the "window" object...
5
by: pd | last post by:
guys, i am trying to put the focus on my popup. When the user clicks on a button i display a popup and want to keep it in focus ie, the user cant minimise or do anything unless they close the...
6
by: David | last post by:
Hi all, I am opening a webform with showModalDialog. This appears to pop-up fine, though I have a problem... Inside the webform is a treeview control. When the treeview is populated, I am...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.