Is this correct ?

#!/usr/bin/perl

т
 
sub tcy{
print "Content-type: text/html\n\n";
print "<script language=\"JavaScript\">";
print " window.open(\"http://24.17.48.48/thanks.html\");";
print " </script>";
}


It doesn't give me anything. Why ?
LVL 1
tanc02Asked:
Who is Participating?
 
ianBConnect With a Mentor Commented:
Hi,

I am answering this question so it can be saved as a PAQ. I am issueing 25 point questions for the experts named in this question, who will find thir questions in this topic area.

Ian
Community Support @ Experts Exchange
0
 
malecCommented:
It works just fine. Any minimized windows on your desktop? Check them.
0
 
malecCommented:
By the way, why not use perl?

use CGI ':standard';
$url = param("url");  

if ($url) {
    print redirect(-URL=>"$url", -TARGET=>"_new");
   }

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
kidziCommented:
I agree, use perl.  Make it easier though than malec:

#!/usr/bin/perl

print "Location: http://24.17.48.48/thanks.html\n\n";

That's all you need.
0
 
tanc02Author Commented:
sorry ! Forget to tell you guys, I wnat to include
width and height and no toolbar in the window.open. can you experts show me how to do it in perl by using javascript ?
0
 
marko020397Commented:
Try this. This will set the width and height and you can also
choose what toolbars and scrollbars to show.

This is the javascript function. Put it somewhere on the top of the html:
<script language="javascript">
<!--

function popup(document) {
  var floater = null
  floater = window.open('','popup','width=254,height=381,resizable=1,status=0,scrollbars=0')
  if (floater != null) {
    if (floater.opener == null) {
      floater.opener = self
    }
    floater.location.href = document
  }
}
// -->
</script>


This is how the link should look like:
<a href="javascript:popup('doc.html')">

There is also a problem in Internet Explorer 3.0. You have to
write the full path for link if you want to work it in Internet
Explorer 3.

Regards
Marko
0
 
tanc02Author Commented:
I don't what a link. I want this javascript to be written into PERL script, since PERL must return something after completeing request.

Let 123.com has a CGI MailForm, and after user
hit submit button, and mail request is completed, then send(javascript) to open a new window with
width=200 and height =100 and no toolbar
0
 
marko020397Commented:
marko changed the proposed answer to a comment
0
 
marko020397Commented:
Use the code I gave in the new HTML which is printed out
by cgi-bin program to open the new window. If you delete
the lines which define this code to be the function the
code will be executed when HTML is loaded. Or put this
function in onLoad handler in html returned by cgi-bin.
0
 
tanc02Author Commented:
i tried it, i didn't see anything
0
 
maneshrCommented:
try this........

in addition to doing what you need, this program also centers the newly open windows!!

====================================================
#!/usr/local/bin/perl

use CGI;

$query=new CGI;

print "Content-type: text/html\n\n";
if ($query->param){      ##      The form has been submitted by user
      $text_message=$query->param('text_message');      ##      Read the CGI data
      print "Content-type: text/html\n\n";
      print qq{
      <html>
      <head>
      <script>
      <!--
            function open_win(){
                  var winWidth = screen.width;
                  var winHeight = screen.height;

                  userWindow=open("http://www.amazon.com","NEWWIN","width=600,height=550,status=yes,resizable=yes,location=yes,toolbar=no,directories=no,menubar=no,scrollbars=yes");
                  userWindow.moveTo((winWidth - 600)/2, (winHeight - 650)/2);
                  userWindow.focus();
                  return false;
            }
            //-->      
            </script>
            <title>
            </title>
            </head>
            <body onLoad="open_win();">
            </body>
            </html>
      };

      print "<P><B>The form data was received by the CGI script<BR>\n";
      print "<B>You entered $text_message</b>\n";
}else{
      print"<HTML>\n<HEAD>";

      print "<FORM ACTION=\"".$ENV{SCRIPT_NAME}."\"METHOD=POST>\n";
      print "Enter anything in the text box: <INPUT TYPE=TEXT NAME=text_message VALUE=\"\">\n";
      print "<P><INPUT TYPE=SUBMIT VALUE=\"Submit Now!!\">\n";
      print "</FORM>\n";
}

0
 
tanc02Author Commented:
Is that possible to open up another window without changing the web site ?

Like A.html is a CGI MAILFORM, and it is written
in html, then call a cgi script to send the mail.

Then after user pressed the button, the mail will be sent, but it open an window to confirm that
mail is sent successfully without changing the A.html. If yes, how ?
0
 
marko020397Commented:
This is not possible. If you have "submit" button in your
form you have to change the HTML. You can always load
the same HTML document, but you have to change it.
0
 
amitpagarwalCommented:

the code seems to be absolutely fine.

please check whether perl exists in the path you have specified in the first line.

hope it help

- amit
0
 
tanc02Author Commented:
points will divided into 25 for marko and 25
for maneshr. Tell me how ?
0
All Courses

From novice to tech pro — start learning today.