473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Confirmation of top.window.close

I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a>
tag on my page that closes itself when you click on it.

What I NEED is for it to put up a confirmation message that simply asks
"This will end your session and close the window", then offers a cancel or
ok button. Clicking on ok closes both the page it was on, and the
confirmation window.

Can someone suggest a simple way to do this?

thanks in advance

Scooter
Jul 23 '05 #1
9 6252
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:RB***************@newssvr21.news.prodigy.com. ..
I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a>
tag on my page that closes itself when you click on it.

What I NEED is for it to put up a confirmation message that simply asks
"This will end your session and close the window", then offers a cancel or
ok button. Clicking on ok closes both the page it was on, and the
confirmation window.

Can someone suggest a simple way to do this?

thanks in advance

Scooter

Will this work for you? Watch for word-wrap.

<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()">
Jul 23 '05 #2
Brilliant, thanks. Removing the href made the pointer stop changing (from
the arrow to the finger) on the mouseover. Is there a way to make it still
act like an href?
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:KeHAd.254456$5K2.34461@attbi_s03...
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:RB***************@newssvr21.news.prodigy.com. ..
I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a> tag on my page that closes itself when you click on it.

What I NEED is for it to put up a confirmation message that simply asks
"This will end your session and close the window", then offers a cancel or ok button. Clicking on ok closes both the page it was on, and the
confirmation window.

Can someone suggest a simple way to do this?

thanks in advance

Scooter

Will this work for you? Watch for word-wrap.

<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()">

Jul 23 '05 #3
ScooterMX wrote:
Brilliant, thanks. Removing the href made the pointer stop changing (from
the arrow to the finger) on the mouseover. Is there a way to make it still
act like an href?


Yes. Make it a link and then it acts like a link. Use the onclick of the
link and return false from it.

Please don't top-post, read the FAQ with regards to such.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:_G****************@newssvr21.news.prodigy.com ...
Brilliant, thanks. Removing the href made the pointer stop changing (from
the arrow to the finger) on the mouseover. Is there a way to make it still act like an href?
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:KeHAd.254456$5K2.34461@attbi_s03...
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:RB***************@newssvr21.news.prodigy.com. ..
I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a> tag on my page that closes itself when you click on it.

What I NEED is for it to put up a confirmation message that simply asks "This will end your session and close the window", then offers a
cancel
or ok button. Clicking on ok closes both the page it was on, and the
confirmation window.

Can someone suggest a simple way to do this?

thanks in advance

Scooter

Will this work for you? Watch for word-wrap.

<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()">


<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()" style="cursor=hand">

Though if it's not IE maybe it's "cursor=pointer".
Jul 23 '05 #5
"McKirahan" <Ne**@McKirahan.com> skrev i meddelandet
news:3FNAd.283031$V41.250254@attbi_s52...
<snip>
<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()" style="cursor=hand">

Though if it's not IE maybe it's "cursor=pointer".


style="cursor:pointer"

Joakim Braun
Jul 23 '05 #6
> <snip>
<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()" style="cursor=hand">


Is there a way to constrain the size of the confirm methods 'window'? The
text I want to use is rather long, and I want it to wrap rather than
stretching the message window across the entire screen.
Jul 23 '05 #7
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:B2****************@newssvr21.news.prodigy.com ...
<snip>
<img src="exit.gif" onclick="if(confirm('This will end your session and close the window')) window.close()" style="cursor=hand">


Is there a way to constrain the size of the confirm methods 'window'? The
text I want to use is rather long, and I want it to wrap rather than
stretching the message window across the entire screen.


Use "\n" for a line break:

<img src="exit.gif" onclick="if(confirm('This \nwill \nend \nyour \nession
\nand \nclose \nthe \nwindow')) window.close()" style="cursor=hand">
Jul 23 '05 #8
> > Is there a way to constrain the size of the confirm methods 'window'?
The
text I want to use is rather long, and I want it to wrap rather than
stretching the message window across the entire screen.


Use "\n" for a line break:

<img src="exit.gif" onclick="if(confirm('This \nwill \nend \nyour \nession
\nand \nclose \nthe \nwindow')) window.close()" style="cursor=hand">


perfect, thanks.
Jul 23 '05 #9
DU
ScooterMX wrote:
Brilliant, thanks. Removing the href made the pointer stop changing (from
the arrow to the finger) on the mouseover. Is there a way to make it still
act like an href?

First, avoid top-posting. Top-posting destroys chronological order of
posts in threads and makes reading more difficult.

Second, use a button, not a link. A link should always act like a link,
fetching a referenced resource on the web. A link should always work
even with javascript support disabled.
If you want to add an image into that button, then you still can.

Third, you would be a lot better with using the onbeforeunload event
attached to the window object: onbeforeunload is supported by MSIE 5+,
Firefox, NS 7.2 and Mozilla releases.

DU

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:KeHAd.254456$5K2.34461@attbi_s03...
"ScooterMX" <sc*****@nowhere.org> wrote in message
news:RB***************@newssvr21.news.prodigy.co m...
I have a <a href="javascript:top.window.close()"><img
src="exit.gif"></a>
tag on my page that closes itself when you click on it.

What I NEED is for it to put up a confirmation message that simply asks
"This will end your session and close the window", then offers a cancel
or
ok button. Clicking on ok closes both the page it was on, and the
confirmation window.

Can someone suggest a simple way to do this?

thanks in advance

Scooter

Will this work for you? Watch for word-wrap.

<img src="exit.gif" onclick="if(confirm('This will end your session and
close the window')) window.close()">


Jul 23 '05 #10

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

Similar topics

28
by: PerryC | last post by:
Anyone know how to auto close the parent / opener window without confirmation? I have tried: <script> opener.window.close() </script> ----I put it in the child html page, and nothing...
2
by: kelvin | last post by:
Hi, I'm having this problem and I can't seem to solve it. I've created a confirmation page. The page displays the form field data and has 2 links - OK (to continue) and Cancel (go back to...
2
by: James Doughty | last post by:
Hello, I am trying to circumvent my users from closing a page as much as possible. I they decided to close then so be it but I want to give them a message telling them they need to continue to...
2
by: steggun | last post by:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick Hello All, I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the server-side code for the LinkButton_OnClick...
2
by: Matthew Lock | last post by:
Is there a better way than this in IE7 for an Intranet page on a trusted site to close a non-script opened window? var WshShell = new ActiveXObject("WScript.Shell");...
0
by: meenu_susi | last post by:
hi.. i am having a default html page... and i want that page to get open without toolbar,addressbar..... i have written a javascript funtion for that.. in that i have used self.close(); but it...
9
by: shiks1305 | last post by:
Hi all, I want to submit a form after confirmation through a customised window. I have 4 buttons in <af:form>, one of which is continue button that has to navigate the form to another page while...
1
by: CutCopyPaste | last post by:
I need to close a window after unsuccessfull password attempts, the problem is the window has frames and is not opened using javascript. When trying to close the window confirmation message, i want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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,...
0
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...

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.