473,473 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multi-function self close question

I used javascript to open a new window, then used the following to close the
new window on the next click:
<body onBlur="self.close()" onClick="self.close()" bgcolor="#FFFFFF">

On the new window I want to place a link to another website, and I want the
new window to open the link in ANOTHER new window (not the parent window)
and then self close.

The idea is that on the first new window I have a picture, and a link to
another website that shows more information about the picture. If the person
just wants to see the picture and go back to my original page, the popup
window disappears. Or if they want more information they click on the link,
and another window pops up and the first popup window disappears. That way
they can look at the new page on someone else's website, and my website page
is still there for them to go back to.

Can I edit the <body> line I used to self close after opening a new window?
I don't want the link to open in the parent window...

Any suggestions?

Thanks,
Ray
Jul 23 '05 #1
4 1982
On Fri, 13 Aug 2004 06:00:31 GMT, Raymond Wilk <rr****@worldnet.att.net>
wrote:
I used javascript to open a new window, then used the following toclose
the new window on the next click:
<body onBlur="self.close()" onClick="self.close()" bgcolor="#FFFFFF">
My first piece of advice is to not do that. There are many reasons why a
window might be sent to the background, and I don't think any of them mean
that the window should close. I frequently shift between page tabs on my
browser, and even external applications. That's what a multi-tasking
environment is supposed to allow. I do not expect to come back and find
that what I was looking gone.

[snip]
Can I edit the <body> line I used to self close after opening a new
window?
I don't want the link to open in the parent window...


That, frankly, doesn't make much sense. I assume you mean, "How do I
modify the <body> line to open a new window, then close the current
window?" If so, call openThenClose(), below:

function openThenClose() {
window.open('theURL','windowName');
window.close();
}

If that isn't what you want, please rephrase your question.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail
Jul 23 '05 #2
> That, frankly, doesn't make much sense. I assume you mean, "How do I
modify the <body> line to open a new window, then close the current
window?" If so, call openThenClose(), below:

function openThenClose() {
window.open('theURL','windowName');
window.close();
}

If that isn't what you want, please rephrase your question.

Mike


I got that to work, but I'm missing one function I didn't make clear. If the
link in the window is NOT clicked I would like the window to close.

After following your advice, I have a window that contains a picture and a
link to another site. If the link is clicked, the first window closes and a
new window opens showing the other site. Perfect. But if the person viewing
the first window just wants to look at my picture and NOT follow the link, I
would like that window to self close on the next click.

If I use <body onBlur="self.close()" onClick="self.close()"> or just <body
onBlur="self.close()"> it over-rides what you gave me, and closes the window
when the link is clicked.

Thanks for helping me, Mike. I'm a graphics guy and all I know how to do
with scripts is copy-paste!
Ray
Jul 23 '05 #3
On Sun, 15 Aug 2004 06:33:51 GMT, Raymond Wilk <rr****@worldnet.att.net>
wrote:
[snip]
After following your advice, I have a window that contains apicture and
a link to another site. If the link is clicked, thefirst window closes
and a new window opens showing the other site.Perfect. But if the person
viewing the first window just wants tolook at my picture and NOT follow
the link, I would like thatwindow to self close on the next click.
So,

1) User clicks on link in main website. This opens new window with
image a link.
2a) User clicks link in new window. Second window opens containing web
page at URL. First window closes.
2b) User clicks elsewhere in page. First window closes, leaving
original site.

That correct? If so, try:

In first window:

<head>
<title>...</title>

<style type="text/css">
body {
bottom: 0;
position: absolute;
top: 0;
}
</style>
</head>

<!-- I still recommend not using onblur="self.close()" -->
<body onclick="self.close()">
<!-- image -->
<!-- A button would be better than a link... -->
<a href="#" onclick="window.open('url','name');return false;"...</a>

</body>

That does what I've listed above. The style sheet is a kludge to ensure
that Opera (and possibly other browsers) register the body click anywhere
on the page. Without it, the body only extends as far as the last element.

If this *still* isn't correct, I apologise for being so dense. :)

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail
Jul 23 '05 #4
> If this *still* isn't correct, I apologise for being so dense. :)

Michael Winter


That's exactly what I'm looking for! Thanks again for the help!
Ray
Jul 23 '05 #5

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

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
1
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...
0
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...
1
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...
0
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...
0
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...
0
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 ...

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.