Top.close Closes The Window Before Responding To Alert In Child Frame

Dec 20, 2005

I am encountering a problem where I have a window and there are three
frames, one in the left, right and in the bottom. The bottom most frame has
common submit buttons. There are several tabs in left frame. Each one loads
a different form on the right frame. After fetching the contents of the form
from user, I am validating the text fields in the form using onChange() event
handler. After entering the text value in the textbox, if I press Submit
directly, the "Submit" as well as the validation routine happens concurrently.
Only at the end of validation, the field is marked as dirty. Now, if field is not
marked dirty, the Submit function will close the window without actually
submitting as nothing was changed. So when an invalid value is entered and
the Submit is pressed directly, an alert pops up temporarily but the close()
call from the parent frame immediately closes the alert window before user
can respond. This problem does not occur in IE as in IE, unless the alert
window is responded, the close() call cannot close the alert window. Code:

View 7 Replies


ADVERTISEMENT

Close Child Window When Parent Window Closes?

May 3, 2009

I'm trying to create code to close the child window I'm creating if the parent window is closed. Here's my code so far:

function openWindow() {
var newWin = window.open(); // open the new window
newWin.document.write('<h1>Child Window</h1>

[Code]...

The above openWindow function is used in this event: <input type="button" name="btn" onclick="openWindow()"value="Open a new window" />

I can generate the new window fine. I just can't close it if the parent window is closed.

View 1 Replies View Related

Trigger Action In Parent Window When Child Window Closes?

Jun 25, 2009

Put a link on my page that will open an external site (over which I have no control) in a pop-up window. When the user closes the pop-up, I want my original page to redirect to another page. The difficulty I'm having is that I can't add any code to the page in the pop-up as it's not my site.

View 4 Replies View Related

How To Keep Child Window Open When Parent Closes?

Jul 23, 2005

I have a closed box system which opens an html page. The page closes by the
system. I have access to the html page. I added code to open a child window
from this page. However when the parent window closes, the child closes
too. Is there a way to keep the child window open? Yes keep it orphaned.

View 2 Replies View Related

Child Window Close Event - Opening Another Link In A Separate Window Using Window.open()

Jan 29, 2010

I have a HTML and I am opening another link in a separate window using window.open() . The child window is something like 'http://yahoo.com' which is out side html. I need to refresh the parent window when the child window is closed.

View 4 Replies View Related

Capture Child Window Close Event In Parent Window?

Feb 1, 2010

I have an HTML page where I am opening a child window using window.open. the child window is something like yahoo.com. I want to refresh the parent window when the child window is closed.

View 1 Replies View Related

How To Close A Child Window?

Jul 20, 2005

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:

Observations:
Error Msg: "progress is undefined".
I have observed that after form submission the 'if' statement in the 'close
child window' code fails because the handle 'progress' appears to have no
value. My guess is that on form submission the handle 'progress' looses its'
value because the action for the form is to reload itself. The 'if' staement
does execute because I have placed an 'alert' statement just prior to it an
the 'alert' executed appropriately.

If I try to open the window after submitting the form, the page doesn't open
until after the file has been uploaded, which defeats the purpose.

Question:
How do I close the window after the form has been submitted?

Thanks for your help!
Irvin.
________________

Javascrtip Code:
________________

To open the child window:
<script language="javascript">
var progress=null;
function sendfile() {
progress=window.open('test2.htm','progress','width =350,height=475');
return true;
}
</script>

To close the child window:
This code follows my PHP code that verifies the file upload.
<script type="text/javascript" language="javascript">
if (progress && !progress.closed) {
progress.close();
}
</script>
________________

View 2 Replies View Related

How To Force A Child Window To Open In Its Frame Set

Jul 23, 2005

How do I force a window, pened alone, to be displayed in its frame set?

tried this:

if (parent.location.href == self.location.href) {
window.location.href = '../'
}

the problem is that the original page is replaced by the main.htm page (the
default page for the 'main' frame)., because the open event of the menu page
calls for the main.htm to be loaded. Is there a way that I could pass a page name as an argument to the index page at all? Something like
window.location.href='index.html?Loc=IT_Study___In formation.htm'

View 3 Replies View Related

Closing HTML Window From Child Frame

Dec 12, 2006

I'm trying to create an HTML page that contains two frames.
The bottom frame should simply be some website, but the top frame needs
to have a close link to kill the window. I tried calling
'document.window.close()' from the child frame, but without success. I
then tried putting the 'close()' call in the parent page and calling it
from the child, but still without success. Code:

View 1 Replies View Related

Link To Close Window And Open Frame?

Mar 1, 2009

I have a page with 3 iframes it has a link to open up a page and when the user clicks on a link on that page - I want the new page to close and the link to open in the second iframe on the original page

View 4 Replies View Related

Close All Child Window With Parent Window?

Nov 26, 2010

I have parent page with 10 child window and i want to close all child window when click on close session button on parent but first i need to check whether any child window open or not after that action should be done for close the child window.

View 4 Replies View Related

Possible To Close All Child Window With Parent Window?

Nov 29, 2010

I want to close all child window with parent window. First i want to detect whether any child window open if open then it should be close after click close button on parent window.

View 8 Replies View Related

Close Child Window In Mozilla Browser?

Jan 14, 2009

I am facing problem while closing the child window in Mozilla Browser. Actually i am using window.close() in order to close the child winow . Its working fine with IE but its not working for Mozilla browser.

View 4 Replies View Related

Display Alert When Close The Browser Window

Dec 24, 2009

I need to display alert when I close the browser window. Now I am using the following code to display the alert. But the alert is getting displayed even I click on any links. But the alert should not displayed when i click the link.

This is my code:

View 1 Replies View Related

Possible To Display Alert When Close Browser Window?

Dec 23, 2009

I need to display alert when I close the browser window. Now I am using the following code to display the alert. But the alert is getting displayed even I click on any links. But the alert should not displayed when i click the link. [code]...

View 6 Replies View Related

Suppress OnBlur Validation Alert On Window Close

Dec 10, 2009

Using Javascript, ASP.net with C# code behind. I am validating a textbox using the onblur event. It is being validated in that it must have an alphanumeric entry before the user tabs off of it to the next box. The validation part works, the part that doesn't work is that I get the validation alert textbox if I close the window. I have a workaround in that I am assigning that textbox a character using windo.onberforeunload but I know that isn't right.

Here is what I have so far...
Code behind on Page_Load...
txtCLBRTNWC.Attributes.Add("onblur", "return reqVLD(this)");

Here is my textbox field...
<asp:TextBox ID="txtCLBRTNWC" runat="server" Width="75" MaxLength="4"
ontextchanged="txtCLBRTNWC_TextChanged" TabIndex="1"
onkeyup="clbwclngCHK(this);" ></asp:TextBox>

And here are the 2 functions being used...
function reqVLD(alphanumericChar){
var chk = /^[a-zA-Z0-9]+$/;
// var boxid = document.getElementById("<%=txtCLBRTNWC.ClientID%>").value;
// var matchArray = boxid.match(chk);
if(document.getElementById("<%=txtCLBRTNWC.ClientID%>").value.match(chk)){
return true;
} else {
document.getElementById("<%=txtCLBRTNWC.ClientID%>").focus();
document.getElementById("<%=txtCLBRTNWC.ClientID%>").value = "";
alert("Please enter a Work Center.");
return false;
}}
function clbwclngCHK(obj_in)//When txtCLBRTNWC entry hits the max of 4 auto focuses to next box. {
if (obj_in.value.length == 4) document.getElementById("<%=txtSTRTDT.ClientID%>").focus();
}

Here is my work around...
window.onbeforeunload = function (){
document.getElementById("<%=txtCLBRTNWC.ClientID%>").value = "1";
}

User has to enter something in box before they can move on. This is checked and validating using an onblur event. Problem is, the onblur event fires if closingexiting the window.

View 9 Replies View Related

JQuery :: Use A Parent-frame - Objected To Make Child-frame AJAX?

Aug 26, 2011

I have a domain: example.com; which is the parent.And a subdomain: api.example.com; which page 'receiver.html' is being loaded in an iframe, child of parent. Both pages set document.domain = example.com.

I'm trying to adapt this code:[url] but Idon't want to load jQuery from the <iframe> again but I need to have the method $.ajax() working from the <iframe> otherwise it would be a cross-domain request and the browser would abort it. I tried ingenuously to set via $('iframe')[0].contentWindow.$.ajax = $.ajax() and I just got a shortcut to the parent page jQuery method. I also tried to "clone" it using $.expand (true...) but the method doesn't work for me; probably because of the complexity of the objected I'm trying to clone. So is there a way for me to use jQuery to have only a $.ajax() method in the <iframe> ? I've thought even about creating a XHR in the child-iframe and then use that in the $.ajaxSetup ({xhr: THATNEWXHR}) but I couldn't do it. I mean, I want to use the XHR factory from jQuery (which has fallbacks for IE, etc) but it has to be created from the iframe-child.

Maybe there is other way to make the AJAX call come from the child-iframe.

If you're wondering "why don't you load jQuery from <script> in the child-iframe", there is a reason... As I'm using jQuery plugins + my own custom javascripts + other independent scripts I created a compiler which minifies each file and bundle them in one. The advantage of this is the reduction of HTTP requests. So "why don't you load that bundle inside the child-iframe?", because it's ugly and Twitter doesn't... Yeah, I like to take Twitter as a reference and I think if they were able to make it so can I;

I got to work in most browsers except IE and Operaby doing it with pure javascript.

I'm "attaching" the code for you guys to test. If you open it with Chrome, Safari or Firefox you will receive 2 alerts one with the return of $.get() and another with the return of a request made via XMLHttpsRequest object. Otherwise (if you open it with IE or Opera) you'll get 'undefined' in the first alert but the real return in the second.

This is the example.com/index.htm:

View 4 Replies View Related

Breaking Out Of Parent Frame If Child Frame Changes URL

Jul 19, 2006

I have a parent document that has a frameset with two frames in it. The first frame is a "header" that runs across the top of the site, and never changes. The second frame contains the "content" of the site. Essentially, I am trying to figure out how to prevent the header appearing above external sites when the user clicks an external link in the "content" frame.

Every time the content frame changes to a new URL, I would like the check that URL and determine if the content frame is changing to an external URL (i.e. different domain in URL) or to an internal link (same domain in URL). If the content is changing to an external link, I want to break out of the frame and just load that external link in the top most document.

I would like all of my javascript to be in the parent document, not spread throughout the individual pages of the site. I was trying to approach this by setting the onunload event handler of the content frame, but I am left with a couple of specific questions:
1. In handling an unload event, can you determine the next URL that the document is loading? Code:

View 6 Replies View Related

Form Opening In The Main Window/ Simeltaneiously Closes Popup Window

Jan 8, 2004

I have a popup window which has the search form in. What I want to do is for the popup window to close once the form is submitted, and to post the form data to a page on the main window.

Is anyone able to advise. As the main page is dynamic, it is not possible to give the page a name.

View 4 Replies View Related

Run Function When Window Closes?

Oct 30, 2010

I'm developing a chat module for our cms. Its working mostly, but I need to make it so that in some situations when someone closes a window that it does a xmlhttprequest to mark the session as closed.Some lite reading seems tell me there is no onclose event, but there is an unload event. Further reading leads me to believe that the unload event may not work when a window is closed.

View 2 Replies View Related

Detect When User Closes Window?

Aug 14, 2009

How do i detect when a user closes my window?

View 4 Replies View Related

Trying To Run Some JS Code Once User Closes Window / Tab

Apr 9, 2010

I am looking to write some code that, once the window is closed, it runs some extra JS which loads a *.php file through an AJAX call. In theory to me it sounds simple but for some reason I cannot get it working. I tried the "onload" attribute but then found that triggers with refresh and links (not good). I simply need the JS code to start running some other JS when the window closes.

Code:
<script type="text/javascript">
function doUnload() {
$.post("");
}
</script>

View 2 Replies View Related

Close Frame From Within That Frame

Jul 1, 2006

anyway, i have 2 frames. how can i close the top frame from a link within the top frame? i want the lower frame to be the only page displayed but i won't be able to know what the lower frame's url will be.

View 1 Replies View Related

Popup Closes Main Window Problem

Jul 20, 2005

I have a simple page on my freebie account site that opens a popup
window running index.asp on another site of mine. The code on the
freebie hosted server is below. What I'd like to do is have the
freebie hosted page shut down once it's opened up the child window.

View 1 Replies View Related

Remember The Time When User Closes The Window?

Feb 17, 2011

I need to remember the time when user closes the window and later when he/she comes back, site will highlight latest news that happened when user was offline. So far the best solution I have found is jquery.unload (since I use jquery): it sends some data to php script (which remembers the time) via ajax when unload event triggers, so is it the best way to solve this problem?

View 1 Replies View Related

How To Close A Pop-up From Other Frame

Feb 9, 2006

I have a page where in there are 3 frames. One frame has a pop-up window implementation where on click of a button on that frame a pop-up is displayed. After pop-up is opened if we click somewhere on the same frame the pop-up will be closed. The problem im facing is if we click on the other two frames the pop-up just goes to the background and is not closing. How can i close this pop-up automatically when i click on other frames?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved