473,657 Members | 2,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A new pop up window will not obey a close command from original page.

I am trying to create a new window from which the original page can
close that new window. For some reason the following code will not
work. Passing the window.open command to a variable called myWindow
does not work with the mouse event, but it seems to work fine with a
javascript: URL command. I would prefer to do it with the mouse event.

Please assist. I can not find any documentation for this in any of my
books.
<!-- Code begins -->

<html>
<body>

<a href="#" onMouseDown="va r myWindow=window .open('text.htm l',
'bobby', 'width=200, height=200');"> Open</a>.
<a href="#" onMouseDown="my Window.close(); ">Close</a>.

</body>
</html>

<!-- Code ends -->
Jul 20 '05 #1
2 3816
ma******@yahoo. com (Marc) writes:
I am trying to create a new window from which the original page can
close that new window. For some reason the following code will not
work. Passing the window.open command to a variable called myWindow
does not work with the mouse event, but it seems to work fine with a <a href="#" onMouseDown="va r myWindow=window .open('text.htm l',
The contents of the onmousedown attribute value is used as the body of
a function. That means that "var myWindow" declares a local variable
in that function ....

<a href="#" onMouseDown="my Window.close(); ">Close</a>.
.... which is not visible from another function.
Drop the "var" and it should work.

Btw,
'bobby', 'width=200, height=200');"> Open</a>.


spaces in the configuration string confuzes some browsers. Remove the
space before "height", and it should work in more browsers.

Add ",resizable=yes ". In the cases where 200x200 isn't enough (and
with user stylesheets, there can be some that you can't predict),
you should allow the user to resize the window. If the content fits,
he probably won't resize anything, so it doesn't hurt to add it.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thank you. That definately worked. I also found articles on local and
global variables, and I have a better understanding of how it works.

I will also be sure to follow the guidelines for the pop up window.

Thanks,
Marc

Lasse Reichstein Nielsen <lr*@hotpop.com > wrote in message news:<he******* ***@hotpop.com> ...
ma******@yahoo. com (Marc) writes:
I am trying to create a new window from which the original page can
close that new window. For some reason the following code will not
work. Passing the window.open command to a variable called myWindow
does not work with the mouse event, but it seems to work fine with a

<a href="#" onMouseDown="va r myWindow=window .open('text.htm l',


The contents of the onmousedown attribute value is used as the body of
a function. That means that "var myWindow" declares a local variable
in that function ....

<a href="#" onMouseDown="my Window.close(); ">Close</a>.


... which is not visible from another function.
Drop the "var" and it should work.

Btw,
'bobby', 'width=200, height=200');"> Open</a>.


spaces in the configuration string confuzes some browsers. Remove the
space before "height", and it should work in more browsers.

Add ",resizable=yes ". In the cases where 200x200 isn't enough (and
with user stylesheets, there can be some that you can't predict),
you should allow the user to resize the window. If the content fits,
he probably won't resize anything, so it doesn't hurt to add it.

/L

Jul 20 '05 #3

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

Similar topics

1
3771
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your HTML form to. the actual form-parsing page resides on a server that's uneditable to me since it sits on an inaccessible server. my problem is more irritating than anything; everything double-submits.. when you submit the form, I've forced a...
3
4573
by: sentinel | last post by:
Hi all, I'm trying to reload a frame from a pop-up, but really cannot figure this out. Within my index.htm file, I make a link to call a pop-up frame with a javascript function that calls the following code from an external javascript source file, dynamically created with PHP document.write('<a href="javascript:void(0);"
19
31043
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). The problem is that after the reload, it brings you right to the top of the page. When I click 'refresh" on the original page, it brings me back to the original viewing position. Is there a way to duplicate this in from the popup window. Also,...
4
5970
by: JeffP | last post by:
I want to add a short-cut to a windows app similar to launching from a windows run line a New window, to prevent changing an existing browser window from moving off a current logged in session to another web application. And, I'd like it to be a chromeless window, sans toobars and sized similar to a popup. TIA
4
34861
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...
2
12568
by: Cheryl | last post by:
Hi, I have encounter a problem.Language use is C#. I would like to open a new window (is a modal window, where I m not able to switch from parent window after this window is open)from the parent window , where there are 3 dropdownlists and a "OK" button. Upon clicking the button, this window will close and the select of the dropdownlists will be collect and send back to the parent window. But I am do not know how to do it. Can...
2
2494
by: Mark | last post by:
Any suggestions on how to go about generating a popup, giving the user a way of searching for something, and then taking their selection after closing the pop-up and populating the parent form with the selection from the child? I can do everything up until the point of having to populate the parent form with the selection from the child form. How do I put the information back into the parent so that the asp.net code in the parent can...
4
8131
by: sam.s.kong | last post by:
Hello! I opened a new window using 'resizable=no'. Can the child window make itself resizable even if it's opened with 'resizable=no'? For example: <body onload="javascript: window.resizable=true;">
2
6932
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. After entering these two items the user can either hit the enter key or press the submit button. The popup window will close and then those two text boxes in the original webpage will be filled in automatically. I would like to have the two...
0
8384
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
8820
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
8718
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...
1
8499
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
7314
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
6162
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
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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
1937
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.