473,325 Members | 2,308 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,325 software developers and data experts.

What do I have to change to get this to work?

This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px, left=300px,
top=300px")
}
</script>
</head>

<body>
<form id='form1' name="form1">
<input type="text" name="textfield">
<input type="button" name="Test" value="Test" onClick="openSub();">
</form>
</body>
</html>

Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more. How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?

Thanks
iv**@tda.no
Jan 12 '06 #1
5 1327
VK

Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


By closing your ModalDialog. ;-)
var userChoice = window.showModalDialog(args);

Why do you think it's called "modal" and "dialog"? It is just
Microsoft's proprietary (though useful) way to display rich formatted
dialog windows. But by its nature and execution mechanics it's the same
as:
var userChoice = window.confirm('OK or Cancel?');

Jan 12 '06 #2
Iver Erling Årva wrote:
This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px,
left=300px,
top=300px")
Should be ended with a semi-colon ...
}
</script>
</head>

<body>
<form id='form1' name="form1">
.... and is not Valid anyway.

<URL:http://validator.w3.org/>
[...]
Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">
It is much the same here.
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more.
In fact, it is rather surprising it already worked without that. For
window.open(), features in the third argument for window.open() are to
be comma-separated, not comma-space-separated.

<URL:http://docs.sun.com/source/816-6408-10/window.htm#1202731>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

And the syntax is different for IE-only window.showModalDialog(): the
features have to be separated by semi-colon there:

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp>
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


As was said, by closing it.
PointedEars
Jan 12 '06 #3
VK

VK wrote:
Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


Actually check for showModelessDialog instead and
dlgObject.dialogArguments property
<http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodelessdialog.asp>

If you have more questions of their usage I guess they are better
suited for microsoft.public.scripting.jscript as not too many people
here ever used them actively (?)

Jan 12 '06 #4
>> How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?
As was said, by closing it.
The problem is that unfortunately closing it is not an option. The window is
generated by a program that opens a modal window and uses it to show a print
preview. If it is a big report, it can take long to display the first page
and I therefore want to send information back to the opener so it can
display some sort of progress status info while the report is being
generated. The good thing is that I have access to part of the code and
therefore could add code to send stuff back, but part of the code is an
active x and isn't mine. It is in that part the window is opened - hence I
cannot change the way it is done.

Iv**@tda.no


"Thomas 'PointedEars' Lahn" <Po*********@web.de> skrev i melding
news:14****************@PointedEars.de... Iver Erling Årva wrote:
This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px,
left=300px,
top=300px")
Should be ended with a semi-colon ...

Yes, I know.
}
</script>
</head>

<body>
<form id='form1' name="form1">


... and is not Valid anyway.

<URL:http://validator.w3.org/>
[...]
Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">


It is much the same here.
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more.


In fact, it is rather surprising it already worked without that. For
window.open(), features in the third argument for window.open() are to
be comma-separated, not comma-space-separated.

<URL:http://docs.sun.com/source/816-6408-10/window.htm#1202731>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

And the syntax is different for IE-only window.showModalDialog(): the
features have to be separated by semi-colon there:

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp>
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


As was said, by closing it.
PointedEars

Jan 13 '06 #5
Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?
As was said, by closing it.


Please provide attribution of quoted material.
The problem is that unfortunately closing it is not an option. The window
is generated by a program that opens a modal window and uses it to show a
print preview. If it is a big report, it can take long to display the
first page and I therefore want to send information back to the opener so
it can display some sort of progress status info while the report is being
generated. The good thing is that I have access to part of the code
and therefore could add code to send stuff back [...]
It is nonsense to block the UA this long. So do not use a modal dialog
here, and modify the code so that it does not open one in the first place.
[Top post]


Please learn to quote.

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars
Jan 13 '06 #6

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

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
86
by: Michael Kalina | last post by:
Because when I asked for comments on my site-design (Remember? My site, your opinion!) some of you told me never to change anything on font-sizes! What do you guys think of that:...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
39
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
1
by: JustMe | last post by:
Hi all, Although I've got quite a lot of experience with php and (M/My)SQL, I only used both within an online php script. These last few months I bought an option with my webhost to access...
6
by: plemon | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
123
by: plenty900 | last post by:
I was looking over someone's C++ code today and despite having written perfectly readable C++ code myself, the stuff I was looking at was worse than legalese. The people who are guiding the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.