473,594 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close window with JavaScript

Hello

I have some trouble in closing a window, Here is the problem:

I develop a asp.net website use client side valiation

<asp:CustomVali dator id="CustomValid ator1"
ControlToValida te="Text1"
ClientValidatio nFunction="Basi cSearchValidati on"
OnServerValidat e="ServerValida tion"
Display="Static "
ErrorMessage="N ot an even number!"
ForeColor="gree n"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
the validation function (JavaScript) is

BasicSearchVali dation(source, arguments)
{
...

w1 = window.open("Po pupErrorMsg.htm ", "example1", "width=400,
height=300, location=no, menubar=no, status=no, toolbar=no,
scrollbars=no, resizable=no");
...
}

ASP.net will automatically call BasicSearchVali dation and open a
window,
but when I click close button on the window, it always prompt a
messagebox to ask me to close it. How can I close the window without
the prompting the messagebox?

Thanks!
John
Nov 17 '05 #1
2 7741
Hi

If your app did not open the window ( window.open ) you will get a confirm
box
http://msdn.microsoft.com/library/de...ds/close_0.asp

There is a hack but I don't think its a good idea using it so I wont post it
:)

--
Best Regards
Vidar Petursson
=============== ===============
Microsoft Internet Client & Controls MVP
=============== ===============
"John H." <jh****@yahoo.c a> wrote in message
news:51******** *************** ***@posting.goo gle.com...
Hello

I have some trouble in closing a window, Here is the problem:

I develop a asp.net website use client side valiation

<asp:CustomVali dator id="CustomValid ator1"
ControlToValida te="Text1"
ClientValidatio nFunction="Basi cSearchValidati on"
OnServerValidat e="ServerValida tion"
Display="Static "
ErrorMessage="N ot an even number!"
ForeColor="gree n"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
the validation function (JavaScript) is

BasicSearchVali dation(source, arguments)
{
...

w1 = window.open("Po pupErrorMsg.htm ", "example1", "width=400,
height=300, location=no, menubar=no, status=no, toolbar=no,
scrollbars=no, resizable=no");
...
}

ASP.net will automatically call BasicSearchVali dation and open a
window,
but when I click close button on the window, it always prompt a
messagebox to ask me to close it. How can I close the window without
the prompting the messagebox?

Thanks!
John

Nov 17 '05 #2
window.opener = self;
window.close();

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.

"John H." <jh****@yahoo.c a> wrote in message
news:51******** *************** ***@posting.goo gle.com...
Hello

I have some trouble in closing a window, Here is the problem:

I develop a asp.net website use client side valiation

<asp:CustomVali dator id="CustomValid ator1"
ControlToValida te="Text1"
ClientValidatio nFunction="Basi cSearchValidati on"
OnServerValidat e="ServerValida tion"
Display="Static "
ErrorMessage="N ot an even number!"
ForeColor="gree n"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
the validation function (JavaScript) is

BasicSearchVali dation(source, arguments)
{
...

w1 = window.open("Po pupErrorMsg.htm ", "example1", "width=400,
height=300, location=no, menubar=no, status=no, toolbar=no,
scrollbars=no, resizable=no");
...
}

ASP.net will automatically call BasicSearchVali dation and open a
window,
but when I click close button on the window, it always prompt a
messagebox to ask me to close it. How can I close the window without
the prompting the messagebox?

Thanks!
John

Nov 17 '05 #3

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

Similar topics

4
22063
by: John H. | last post by:
Hello I have some trouble in closing a window, Here is the problem: I develop a asp.net website use client side valiation <asp:CustomValidator id="CustomValidator1" ControlToValidate="Text1" ClientValidationFunction="BasicSearchValidation" OnServerValidate="ServerValidation"
5
9701
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to click that opens the site in a new and larger window via onclick. My question is, can I have the smaller window automatically close when the user clicks the link to visit the site? I also have a link that merely closes the smaller info window if...
2
9305
by: Simon Fletcher | last post by:
Hello there, I need a "Close Window" script ( onLoad.Close.Window() ), however i need the script so it don't come up with this annoying window: "This window is trying to close" window. Is there a script to stop this happening and close the window anyway? Simon Fletcher
2
18696
by: Irvin Amoraal | last post by:
Process: I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window containing some text and an animated GIF. The javascript returns 'True' and the file is uploaded. All of that works great. Problem: Now I am trying to close the child window after the file has been uploaded. Below is the JavaScript I'm using:
6
2734
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the work. Nota() - opens new window. fechaNota() - closes the window opened by Nota() here is the code.
4
34853
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen as a new window. The original window plus the Modally opened Pop remain in a separate window. What I want to do is close the popup and return to the original window with its view state maintained. The control use to fire the popup window...
5
3078
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
7
5809
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed to be two techniques for earlier versions. But the window.opener='' ;window.close(); and the window.open('','_parent','') ;window.close(); techniques do not work for me. I.e., I still get confirmation message
2
6749
by: kurt sune | last post by:
Hello, I have a weird problem, I hope someone can explain this for me. I have a webpage using masterpage. In it I create a popup window using this code: Dim js As String = "<script language=javascript>" js &= "var newWin = window.showModalDialog('InkommetVi.aspx" js &= "',null,"
6
3236
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am looking for a java script to close a web form that I can attatch to a button click event. I am using vs2005, c#. Thanks -- Paul G Software engineer.
0
7880
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8255
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8242
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6665
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5413
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.