Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RE: How to open a file.. in a new window? 1

Status
Not open for further replies.

ggordon

Programmer
Sep 15, 2003
45
I have a snippet of code that goes like this:

{
$file = "correct.html";
open(FILE, $file);
while(<FILE>)
{
print $_;
}
close(FILE);
}


My question is ...

Is there an easy way to modify this code .. so that the page &quot;correct.html&quot; will do one of a few things, depending upon what I need.

1) How can I get it to load in a NEW window, for example (in HTML) as in target=&quot;_blank&quot; ?

2) How can I get it to load in an already loaded window, such as a previously opened window that might be named &quot;main&quot;, for example (in HTML) as .. target=&quot;main&quot; ?

Is there a way, to simply modify the above code (at the top of the page) so I can direct the page to load into a new or different window?

What do I need to do?

Help??

Thanks,
Gary
 
Where the file opens is going to be determined by the link that was clicked the generate the page. TARGET is property of an <A> element in this case.

So, if your link to the cgi is

<A HREF='page.cgi'>

add

<A HREF='page.cgi' TARGET='_blank'>

Now, you can programmatically generate that link to do what you want it to do.

 
siberian,

Well, here's the scenario .. so maybe you can better explain this to me if I describe the situation.

There is a link on from a main window, let's say the index.html of a website .. that says : &quot;Login Here&quot;

When the user clicks on &quot;Login Here&quot;, a pop up window (using javascript) occurs. So, now the fields that request a username and password .. are displayed in the small pop up window. This pop up window is named .. &quot;popup&quot;.

After the user enters their username and password, and clicks the submit button (in the small &quot;popup&quot; window), I want to:

1) Have the pop up window automatically close.
2) Load the new page called correct.html load into EITHER a new (_blank) window .. or .. most likely have it load into the previous and main window (which was the index.html page).

What and how do I code this in order to make it happen .. being that the submit information is being sent to the cgi script?

Can you help and explain (specifically) what needs to be done?

Thanks,
Gary
 
This is 100% not a CGI issue, the javascript forum can help you.

Basically you want to:

A) Name the 'main' page using javascript (I think you can do this in the body tag onLoad or something)
B) Target the new window when the user clicks the link.
C) The new window contains the form
D) Have the form submission submit the info, reload the 'main' page and then close itself.

Voila, done, we do this all the time I just do not have the syntax on-hand. The JS forum can give it to you quickly or perhaps you can use this algorithm to write it yourself.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top