How to open a new window

T

Todd Cary

When the surfer clicks on the anchor, I would like to have a new window
open. Can this be done? This is what I have tried:

<!--
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
//-->


<td align="left" class="Even"><a href="#"
onClick="MM_openBrWindow('show_imagephp','','')"> Notice </a></td>


Todd
 
L

Lee

Todd Cary said:
When the surfer clicks on the anchor, I would like to have a new window
open. Can this be done? This is what I have tried:

<!--
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
//-->


<td align="left" class="Even"><a href="#"
onClick="MM_openBrWindow('show_imagephp','','')"> Notice </a></td>

That should work, assuming that all of the parts of the page that
you haven't shown us are correct and the browser isn't set to
refuse to allow popup windows from script.

The window will probably be empty, becuase "show_imagephp" doesn't
look like a valid URL. Did you mean "show_image.php" ?

The comments around the function definition are pointless, and
one of the things that we're assuming is that that function
definition is contained in a <script type="text/javascript"></script>
block.

What happens when you try it?
 
D

David Dorward

Todd said:
When the surfer clicks on the anchor, I would like to have a new window
open.

Does the surfer want a new window to open? I'm yet to encounter a popup that
was a good idea.
<!--
Pointless

function MM_openBrWindow(theURL,winName,features) {

Uh oh. A Macromedia JavaScript routine. Anything that starts MM_ is likely
to be a bad idea.
window.open(theURL,winName,features);

So, this funtion takes three parameters, then passes them on to another
function with takes the same three parameters, in the same order, with no
manipulation of them whatsoever. Get rid of it.

The one like of code in this script with no problems!

Pointless. Ditch it.
<td align="left" class="Even">

Why isn't that align left in your stylesheet?
<a href="#"

Href equals what? Why are you linking to the top of the page here? If you
want to attach JavaScript to a link, then the link itself should do
something sensible. Usually this means a sane fallback, sometimes it means
a link to a document begging forgiveness to the user for not having a
proper fallback in place for when the scripting fails.
onClick="MM_openBrWindow('show_imagephp','','')"> Notice </a></td>

<a href="show_imagephp"
onclick="if (window.open) { window.open(this.href,'popup',''); return
false; }">
 
T

Todd Cary

First I want to express my appreciation to those who took the time to
answer my question. As you can determine from my code, this is not my
area of expertise. Every few months I am asked to create a Web site for
my client, and since I am their only programmer (Delphi is my main
language), I get the task of creating the sites.

In this particular site, the attorney's will search for class action
claims that are in TIFF format and view them in PDF. All of this is
being done dynamically in php (quite a learning curve for me!) which
brings up a PDF page in the PDF viewer. My challenge is to make wo when
the viewer closes the PDF page, they do not close the browser. My
solution is to make a new window for the PDF Viewer.

As indicated by your detailed responses, HTML and JavaScript are your
areas of expertise. Your suggestions are welcomed, including the
improved use of CSS (wish one of you worked for my client so I could
learn from you0.

Host: http://209.204.172.137/carf/php/login.php
User: tester
PW: test

Thank you again....

Todd
 
T

Todd

I forgot to say that I had a typo with the escape characters in PHP so
the URL was not correct plus some other typos. Thank you for finding
them!

<td class="Even"><a href="#" onClick="MM_openBrWindow('show_image.php?
image=./tiff/demo_good.tif&session_id=1130685270
&claim_ref=1000001','','')">1000001</a></td>

Also, there is only one test record in the DB that is brought up with a
"C" in the Last name field.

http://209.204.172.137/carf/php/login.php

User: tester
PW: test
 
G

Gert-Jan Strik

onClick="MM_openBrWindow('show_imagephp' said:
<a href="show_imagephp"
onclick="if (window.open) { window.open(this.href,'popup',''); return
false; }">

Tod, if the purpose of your popup is to avoid that the user moves away
from your main page, then could use a variation of David's suggestion:

<a href="show_imagephp" target="popup"
onclick="if (window.open) { window.open(this.href,this.target,'');
return false; }">

Gert-Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top