Click to See Complete Forum and Search --> : CGI creating JavaScript


divaone
05-06-2003, 07:14 AM
Hello all,

I need some information on how to make a cgi script output javascript. This may not be worded correctly. What I really need is for a script I currently have to allow other users to call the script to their pages (on their own sites) and also allow them to customize the css within the script.

The script is called directly, and I've used it in an iframe. I would like some documentation/examples on how users can customize it directly.

Was this clear?
Thanks in advance

Scriptage
05-07-2003, 10:54 AM
#!/usr/bin/perl -w

use strict;
use CGI qw(:all);
print header(-type =>" text/javascript");

my $colour = param('colour');

print<<JSCODE;
var colour = $colour;
JSCODE

Ther you have javascript code output from a perl file.

you can then call the file by <script src ='yoursite.com/cgi-bin/thefilename.pl?colour=red'></script>

Regards

divaone
05-10-2003, 06:29 AM
Thank you for the response. I'm still trying!