473,388 Members | 1,340 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,388 software developers and data experts.

How to check for a named window

A window may or may not be created by me and JavaScript. When the "OK"
button is pressed, I do a JavaScript Close(), but I want to make that
conditional on whether the user is in a window called "pdfWin".

Currently the button is created with

<input name="btnContinue" type="button" onClick="MM_closeWindow()"
value="OK">

And my MM_closeWindow() is

function MM_closeWindow() {
window.close();
}

Not that is really matters, all of this is in my PHP code.

Thank you......

Todd

*** Sent via Developersdex http://www.developersdex.com ***
Oct 30 '05 #1
4 1584
Todd said the following on 10/30/2005 2:13 PM:
A window may or may not be created by me and JavaScript. When the "OK"
button is pressed, I do a JavaScript Close(), but I want to make that
conditional on whether the user is in a window called "pdfWin".
If you only want the button available in the window named pdfWin, then
only generate the code for that window.
Currently the button is created with

<input name="btnContinue" type="button" onClick="MM_closeWindow()"
value="OK">

And my MM_closeWindow() is

function MM_closeWindow() {
window.close();
}
That looks like left over Dreamweaver code. If nothing else, change the
name so that nobody else is aware that you have ever used DW created
scripts. It also seems counter-productive to call a function that only
closes a window.
Not that is really matters, all of this is in my PHP code.


Add a parameter to the URL that lets the server know you are opening it
in pdfWin and only generate the code for that page if it is in pdfWin.

Barring that, you can check the windows name property.

if (window.name == 'pdfWin'){
window.close();
}

You may look into generating that button so that if the page is not in
pdfWin, then users don't get a broken button.

But, why do people seem to want to duplicate browser functionality?
Most, if not all, browsers have an X in the corner to close it, and most
users know how to close that window without a button/link on a page to
do it for them.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 30 '05 #2
Ivo
"Todd" wrote
A window may or may not be created by me and JavaScript. When the "OK"
button is pressed, I do a JavaScript Close(), but I want to make that
conditional on whether the user is in a window called "pdfWin".

function MM_closeWindow() {
window.close();
}
Make that:
if( window.name==='pdfWin' ) { window.close(); }

Not that is really matters, all of this is in my PHP code.


Speaking of what matters, it may be in a page which is in whole or part
produced by a PHP script, but the underlying origin is of no concern once
downloaded. The code you showed is nothing but the purest HTML and
Javascript.
hth
ivo
http://4umi.com/web/javascript/
Oct 30 '05 #3
Randy -

<<<
But, why do people seem to want to duplicate browser functionality?
Most, if not all, browsers have an X in the corner to close it, and most
users know how to close that window without a button/link on a page to
do it for them.
Apparently you have not had the experience of working for
attorney clients like mine...you lucky!!

<<<
Add a parameter to the URL that lets the server know you are opening it
in pdfWin and only generate the code for that page if it is in pdfWin. Great solution!! Thank you. If you put this into your browser, you got
there without a valid session_id; therefore, the window was not created:

http://209.204.172.137/carf/php/show_image.php

<<<
If nothing else, change the name so that nobody else is aware that you
have ever used DW created scripts.

And due to my lack of JavaScript experience, I thought that was a
routine naming convention :-) . Though I have DreamWeaver, I found that
the code it produces was more confusing than even my HTML. I was asked
to add some PHP code to a non-profit Web site and when I told the "Web
master" that all he would have to do is add some HTML code to his pages,
he told me that he does not know HTML; he uses DreamWeaver. Uggggg!

Thank you for the suggestions...greatly appreciated! Love to
communicate with you off line.

Todd

*** Sent via Developersdex http://www.developersdex.com ***
Oct 30 '05 #4
Todd said the following on 10/30/2005 4:38 PM:
Randy -

<<<
But, why do people seem to want to duplicate browser functionality?
Most, if not all, browsers have an X in the corner to close it, and most
users know how to close that window without a button/link on a page to
do it for them.

Apparently you have not had the experience of working for
attorney clients like mine...you lucky!!
No but some just as dumb. I usually remind them that they are
professionals in there profession, not mine. And I usually end up
knowing better about mine than they do.
<<<
Add a parameter to the URL that lets the server know you are opening it
in pdfWin and only generate the code for that page if it is in pdfWin.

Great solution!! Thank you. If you put this into your browser, you got
there without a valid session_id; therefore, the window was not created:

http://209.204.172.137/carf/php/show_image.php
Then you shouldn't have the problem you describe. If php only generates
the page when you allow it, and you generate the link via JS, then only
JS can open that window.
<<<
If nothing else, change the name so that nobody else is aware that you
have ever used DW created scripts.

And due to my lack of JavaScript experience, I thought that was a
routine naming convention :-) . Though I have DreamWeaver, I found that
the code it produces was more confusing than even my HTML. I was asked
to add some PHP code to a non-profit Web site and when I told the "Web
master" that all he would have to do is add some HTML code to his pages,
he told me that he does not know HTML; he uses DreamWeaver. Uggggg!


I have had similar experiences. Whenever I need a good laugh, I remember
them.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 30 '05 #5

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

Similar topics

3
by: deko | last post by:
I use #currentlink in a nav list of links to indicate which page is currently being viewed. The code in the nav list looks like this: <p><a href="index.php">Home Page</a></p> <p><a...
1
by: John | last post by:
HI, I was wondering if it is possible to target a named anchor in a frame when opening a new window with a javascript function? has anyone actualy been able to do this? Thanks in advance for...
3
by: Tim | last post by:
Hello All! I'm having a difficult problem and I'm wondering if anyone can help. Here's the deal. I have a webpage with multiple forms on it. All of the forms have drop down boxes that when...
2
by: Mike | last post by:
I´ve got a number of SPAN elements named "mySpan1", "mySpan2", "mySpan3" etc, and want to set their "style.display" to "inline". This works (only needs to work on IE5.5+): for (var x = 1; x <...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
1
by: leem | last post by:
Hi Can some body guide me how to Link the check box value to Text Box. below is the problem . I've two options in the Check Box method where I've make a Option group for that to select the one...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I check to see if a childwindow is open, before opening another?...
2
by: Steve JORDI | last post by:
Hi, I'm having a little trouble trying to update a page content when the user clicks a check box. Basically, I need to reload a page to update its content depending on that checkbox status. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.