Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Fri, 11 Jul 2008 15:59:54 -0700,    group: microsoft.public.inetsdk.programming.scripting.jscript        back       


Close window opened with showModalDialog   
I am opening a window with the showModalDialog method. The page has two 
buttons on it, Yes and No. For the onclick event of each button I have this 
code:

onclick="done('Yes')
- or -
onclick="done('No')

Here is the done function in JScript:

function done(decision)
{
    window.returnValue = decision;
    window.close;
}

But the window does not close! It does not give any error, either. I even 
tried swapping the position of the two lines (calling close first); it still 
does not close. If I manually close it after clicking a button (regardless 
of the order of the two statements), it correctly passes the return value to 
the caller. Does anyone have any idea why this isn't working? Thanks!
date: Fri, 11 Jul 2008 15:59:54 -0700   author:   Ron Hinds

Re: Close window opened with showModalDialog   
"Ron Hinds"  wrote in message
news:Oo3jVn64IHA.3784@TK2MSFTNGP06.phx.gbl
> function done(decision)
> {
>    window.returnValue = decision;
>    window.close;
> }

Surely you want window.close()  (note the pair of parens).
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Sat, 12 Jul 2008 01:08:24 -0400   author:   Igor Tandetnik

Re: Close window opened with showModalDialog   
"Igor Tandetnik"  wrote in message 
news:%23Hv2S194IHA.4492@TK2MSFTNGP04.phx.gbl...
> "Ron Hinds"  wrote in message
> news:Oo3jVn64IHA.3784@TK2MSFTNGP06.phx.gbl
>> function done(decision)
>> {
>>    window.returnValue = decision;
>>    window.close;
>> }
>
> Surely you want window.close()  (note the pair of parens).

Unfortunately, it doesn't work that way, either ;-(
date: Mon, 14 Jul 2008 09:51:51 -0700   author:   Ron Hinds

Re: Close window opened with showModalDialog   
Ron Hinds  wrote:
> "Igor Tandetnik"  wrote in message
> news:%23Hv2S194IHA.4492@TK2MSFTNGP04.phx.gbl...
>> "Ron Hinds"  wrote in message
>> news:Oo3jVn64IHA.3784@TK2MSFTNGP06.phx.gbl
>>> function done(decision)
>>> {
>>>    window.returnValue = decision;
>>>    window.close;
>>> }
>>
>> Surely you want window.close()  (note the pair of parens).
>
> Unfortunately, it doesn't work that way, either ;-(

Works for me just fine. I've tested it with this (saved as test.html):

<html>
<head>
<script language="javascript">
function showDialog() {
  window.showModalDialog("test.html");
}
function done() {
  window.close();
}
</script>
</head>

<body>
<button onclick="showDialog();">Open dialog</button>
<br>
<button onclick="done();">Close window</button>
</body>
</html>

-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Mon, 14 Jul 2008 13:10:06 -0400   author:   Igor Tandetnik

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us