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: Perl Programming Help: Intermediate: Re: [babyboy] Add Javascript files and Javascript code using CGI.pm: Edit Log



KevinR
Veteran


Jul 4, 2008, 9:45 PM


Views: 2977
Re: [babyboy] Add Javascript files and Javascript code using CGI.pm

try this:


Code
use CGI qw/:standard/; 
my $javascript = <<END;
function checkRemove(element) {
var obj = document.getElementById(element);
if (obj) {
obj.getParentNode().removeChild(obj);
return true;
}
return false;
}
END

my $srcfile = './wanker.js';

print header,
start_html(-title=>"Wanker!",
-script=>{-type=>"text/javascript",
-src=>"$srcfile"},
-head=>script{-type=>"text/javascript"},$javascript,
);


the -head tag allows for arbitary things to placed in the head section of the html document. It is discussed in the same section I referenced previously.
-------------------------------------------------


(This post was edited by KevinR on Jul 4, 2008, 9:49 PM)


Edit Log:
Post edited by KevinR (Veteran) on Jul 4, 2008, 9:49 PM


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

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