473,796 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i close a pop up from the parent onload

when a form is submitted from the main window i want a pop up window
to open from the onclick event. i have that working, now how can i
close the pop up window from the main window after the main window
finishes loading? i've been racking my brain on this for the last two
days. here is the code for the parent window that i have been testing
with.

testfoo.htm is just a blank html page used for testing.

<head>
<title>Personne l Information</title>
<script language="javas cript" type="text/javascript">
var newWindow;
//alert(newWindow + " page load");

function openDialogWin() {
var height = "300";
var width = "500";
var x = (screen.width - width) / 2;
var y = (screen.height - height) / 2;
var Name = window.name;
//alert(height + ", " + width);

features = "height=" + height + ",width=" + width + ",left="
+ x + ",top=" + y;
features += ",menubar=no,re sizable=no,titl ebar=no,scrollb ars=no,status=n o,toolbar=no,me nubar=no,locati on=no";
var newWindow = window.open(une scape("/testfoo.htm"),
"newWindow" , features);
//alert(newWindow .name + " in openDialogWin") ;
return newWindow;
}

function closeDialogWin( ) {
if (newWindow && !newWindow.clos ed)
newWindow.close ();
}
</script>

</head>
<body onLoad="closeDi alogWin();">
<form method="post">
<input type="submit" name="foo" value="Submit"
onclick="openDi alogWin();">
</form>
</body>
</html>

sorry about the formatting... it looks ok in the editing window. if
anyone can clue me in on how to format the code for the boards, i'll
do my best to comply.

thanks in advance

jones
Jul 20 '05
11 2961
Kevin Jones wrote:
here is my final solution - and surprisingly it works! thanks to
everyone who viewed and replied to this thread.

well, i couldn't find any better solution and since i've been wracking
my brain over this since last wednesday, i took the easy way out and am
faking disabling the button. i put the original submit buttons inside of
a span with an id of "able" and created identical dummy buttons inside
of a span called "disabled". when one of the original buttons is
clicked, it hides "able" and displays "disabled". and since this is done
on the client side, the change is instant in their browser (as far as i
know). here is the code i used:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled </title>
<script language="JavaS cript">
function bigFake() {
able.style.disp lay = "none";
disabled.style. display = "";
}
</script>

you should test that in something besides IE....

--
Randy

Jul 20 '05 #11
In article <40************ ***********@new s.frii.net>,
ja********@hotm ail.com enlightened us with...

<html>
<head>
<title>Untitled </title>
<script language="JavaS cript">
function bigFake() {
able.style.disp lay = "none";
disabled.style. display = "";
}
</script>
</head>


This will fail in NN/Moz.
You forgot document.getEle mentById("able" ) syntax is required in non-IE
browsers. Only IE knows that shortcut you used.
NN says "able is not defined".

--
--
~kaeli~
A man's home is his castle..., in a manor of speaking.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #12

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

Similar topics

3
5187
by: J P Singh | last post by:
Hi Guys Wonder if someone can help me with this. I have a form where a user clicks a button which gives them a pop up windows to allow them to add the data. The user adds the data and click save. The pop window closes and refreshs the parent window to allow the entered data to be displayed. It was all working okay until couple of days back when it stopped.
1
3764
by: Marshall Dudley | last post by:
I have an application where in a shopping cart checkout a popup appears which suggests other items that may go with what was ordered with a button to add these items to the cart. When the button in the popup is clicked, the popup should present an added items to cart message, close, and reload the parent window, so the parent will show the new item in the cart. It is all working except the post contents for the parent window are being...
1
3374
by: gopal srinivasan | last post by:
I need to know how to close a parent modal window when child modal window opens, also i need to know the syntax for writing document on the modal window on the fly, like what we do in case of normal window. Actually, I tried to close the parent window from the child modal window using parent.close syntax in onload event in child modal window. It actually closes the parent modal window, but the child modal window is not opened, why it is...
4
5669
by: Colin Graham | last post by:
Hi guys, Just a quickie here that i hope someone can help me with. Basically i want stop the user from closing the popup window using the small x button in the top right hand corner. Im aware that i cant disable this so i thought is it possible to do a check to see if a hidden text on the main form has a value. E.g. if we close the popup correctly then text box on the main form will say true. If we close the text box using the x in the...
1
1834
by: Marcel | last post by:
I have a subwindow hich displays a grid. When the user selects a row from the grid, I wish to store the selected row ID in session state and close the subwindow, returning focus to the parent (opener). Normally I would do this in javascript, but I cannot find any client side intelligence in the grid, so I wish to close the window on the select index changed event when I return to the server. I can't remeber how to add an OnLoad...
4
14475
by: stevong | last post by:
It works on Konquerer though. I remember it works on IE too. I've tried window.close() too. Doesn't work on Firefox also. I've also tried to create a function. It doesnt work on Firefox also. Bottomline is: Firefox doesn't accept window.close() or self.close()? Are there ways to rectify the issue? Please advise.
7
2515
by: Jaggu | last post by:
Hi , I need to close main window, once the child window succesfully opens else main window to remain. In my case when I close the main window immediately after the "window.open()" as mentioned below, both the main and child disappears(this is due to pop up blocker) disappears suddenly. I want to make the browser know if pop up blocks the child window(in case). help me how to check the child window opened successfuly or not, on
1
2474
by: Socrates | last post by:
Hi - Have tried for half and hour to get this script to work: I am trying to close the parent window while opening a centred new child window I would be grateful if someone could correct the script below which does open a new window, but not in a centred position. Here is the link to the url:
13
5521
by: petcancervet | last post by:
I am writing a PHP/MySQL web-page based system on Firefox and wish to run a separate page from an <Alink to run a separate PHP script, then close that page. Firefox starts a new tab for this and it closes OK but I am then left with an egg-timer at the mouse arrow when over top or bottom toolbars areas of the parent page. I am using <BODY onLoad='Javascript:close()'to fire the tab closure. I have tried opener.focus() with no effect. I...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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
10467
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...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9061
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...
1
7558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
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
2
3744
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.