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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.write perl

Status
Not open for further replies.

blitzer

Programmer
Jun 18, 2001
34
CA
hi.. im trying to write the contents of this page via JavaScript.. no matter what I do it isn't working.. any help would be appreciated.


$URL = "my $content = get($URL);

$content =~ s/'/\\'/g;
$content =~ s/\?/\\?/g;
$content =~ s/;/\\;/g;
$content =~ s/"/\\"/g;
$content =~ s/@/\\@/g;
$content =~ s/&/\\&/g;
$content =~ s/\n//g;
$content =~ s/\\n//g;


print "Content-type: text/html\n\n";
print "document.write('$content')\;\n";
 
don't know how that ;; got there... anyway the problem is not with the perl code that works fine.. i just can't get the javascript to generate. when i call it with this on an html page:

<SCRIPT LANGUAGE=&quot;JavaScript&quot; SRC=&quot; </SCRIPT>
 
Try changing your Content-type in the perl from text/html to application/x-javascript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top