CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Other Programming Languages: Javascript:
calling javascript function from perl

 



reenadpatel
New User

Jan 23, 2003, 11:20 AM

Post #1 of 2 (24556 views)
calling javascript function from perl Can't Post

calling javascript funtion from html part of perl script

i am trying to open a file using Perl and then calling a javascript function in the body onload to set values to variables..but the onload does not seem to work..

pl. help..(script attached)
Reena

#!/usr/bin/perl

# environment variables

$request_method = $ENV{'REQUEST_METHOD'};

# HTTP Content Header
print("Content-type: text/html\n\n");

#check request method
if($request_method eq "POST") # Post method start
{
binmode(STDIN);
@inx = <STDIN>;
@filetest = <STDIN>;
$str = @inx[1];
$str1 = reverse $str;
$filename1 = "";
$currchar = "";
$offset = 3;
while ($currchar !~ /\\/) {
$currchar = substr($str1, $offset, 1);
if ($currchar !~ /\\/) {
$filename1 = "$filename1$currchar";
$offset++;
}
}
$filename2 = reverse $filename1;
splice(@inx,0,4);
splice(@inx,$#inx,1);
$in = join("",@inx);
$in = substr($in,0,length($in) - 2);;
print ("<html>\n");
print ("<head>\n");
print ("<script language=\"Javascript\">\n");
print ("function add(){\n");
print ("alert(\'$in\')\;\n");
#print ("var range =opener.parent.right.document.body.createTextRange()\;\n");
#print ("alert(opener.parent.oldhtml)\;\n");
#print ("opener.parent.oldhtml = opener.parent.oldhtml + \'$in\'\;\n");
#print ("alert(opener.parent.oldhtml)\;\n");
#print ("range.pasteHTML(opener.parent.oldhtml)\;\n");
print ("}\;\n");
print ("<\/script>\n");
print ("<\/head>\n");
#This line is giving an error
print ("<body onload=add()>\n");
print ("check\n");
print ("<\/body>\n");
print ("<\/html>\n");
}
#exit main script
exit 0;


BackUp
Novice

Jan 23, 2003, 12:35 PM

Post #2 of 2 (24552 views)
Re: [reenadpatel] calling javascript function from perl [In reply to] Can't Post

What is the error?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives