tanc02
asked on
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 ?
т
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 ?
It works just fine. Any minimized windows on your desktop? Check them.
By the way, why not use perl?
use CGI ':standard';
$url = param("url");
if ($url) {
print redirect(-URL=>"$url", -TARGET=>"_new");
}
use CGI ':standard';
$url = param("url");
if ($url) {
print redirect(-URL=>"$url", -TARGET=>"_new");
}
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.
#!/usr/bin/perl
print "Location: http://24.17.48.48/thanks.html\n\n";
That's all you need.
ASKER
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 ?
width and height and no toolbar in the window.open. can you experts show me how to do it in perl by using javascript ?
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','wi dth=254,he ight=381,r esizable=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('do c.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
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','wi
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('do
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
ASKER
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
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
marko changed the proposed answer to a comment
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.
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.
ASKER
i tried it, i didn't see anything
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->para m('text_me ssage'); ## 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=6 00,height= 550,status =yes,resiz able=yes,l ocation=ye s,toolbar= no,directo ries=no,me nubar=no,s crollbars= yes");
userWindow.moveTo((winWidt h - 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_NAM E}."\"METH OD=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";
}
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->para
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
userWindow.moveTo((winWidt
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_NAM
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";
}
ASKER
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 ?
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 ?
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.
form you have to change the HTML. You can always load
the same HTML document, but you have to change it.
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
ASKER
points will divided into 25 for marko and 25
for maneshr. Tell me how ?
for maneshr. Tell me how ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.