D
dan
Solution
Having trouble with a javascript alert which contained an apostrophe
within a perl CGI script, through trial and error I eventually found out
that triple escaping the apostrophe works. No idea why.
#!/usr/bin/perl -T
use CGI qw/:standard/;
my $JSCRIPT=<<EOF;
function alertme() {
alert('apostrophe\\\'s');
}
EOF
;
print
header,
start_html( -script => $JSCRIPT ),
start_form(),
submit( -onClick=> "alertme()" ),
end_form,
end_html
;
Having trouble with a javascript alert which contained an apostrophe
within a perl CGI script, through trial and error I eventually found out
that triple escaping the apostrophe works. No idea why.
#!/usr/bin/perl -T
use CGI qw/:standard/;
my $JSCRIPT=<<EOF;
function alertme() {
alert('apostrophe\\\'s');
}
EOF
;
header,
start_html( -script => $JSCRIPT ),
start_form(),
submit( -onClick=> "alertme()" ),
end_form,
end_html
;