Mario R. Sanchez, Ph.D. wrote:
: hi charles
Hello!
: i also tried
:
: print qq(
: <script type="text/javascript">
: document.open();
: document.write('<p>What ever you want to write FROM THE SCRIPT<\/p>');
: document.writeln('<p>What ever you want to write FROM THE
: SCRIPT<\/p>'); document.close();
: </script>);
:
: in perl script instead of the regular print images noted below
:
: and still no work ...
:
: the script called directly, either with perl *print* of
: document.write works. called from an html invocation everything
: works except the output back to the browser...
I wouldn't expect it to work this way. Perhaps we are
misunderstanding each other. The <script> tags are used in both
the body and the header of the HTML file. In the header, I would
not expect anyone to print to the document. That's done in the
body.
Here's an example that works on Apache over Windows XP. Note
that we create function in the HTML document header and then use
it in the body. There is a second working example below that one
which does use this two step approach.
a.pl:
#!/usr/bin/perl
use strict;
use warnings;
print
q{
function foo () {
document.write('Sample Text.');
}
};
__END__
sample.html:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>tabs.html</title>
<script type="text/javascript" language="Javascript"
src="http://localhost/cgi-bin/a.pl"></script>
</head>
<body>
<div>
<ul>
<li><script type="text/javascript">foo()</script></li>
<li><a href="/tabs.html">About</a></li>
<li><a href="/tabs.html">Home</a></li>
<li id="current"><a href="/news.html">News</a></li>
<li><a href="/products.html">Products</a></li>
<li><a href="/news.html">Contact</a></li>
</ul>
</div>
</body>
</html>
As an alternative, I also was successful just doing it in
the body as you had before. Note that the output from a.pl has
changed. I'm not sure how you will do the image, but this gives
you a good starting point.
a.pl:
#!/usr/bin/perl
use strict;
use warnings;
print q{ document.write('Sample Text.'); };
__END__
sample.html:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>tabs.html</title>
</head>
<body>
<div>
<ul>
<li><script type="text/javascript" language="Javascript"
src="http://localhost/cgi-bin/a.pl"></script></li>
<li><a href="/tabs.html">About</a></li>
<li><a href="/tabs.html">Home</a></li>
<li id="current"><a href="/news.html">News</a></li>
<li><a href="/products.html">Products</a></li>
<li><a href="/news.html">Contact</a></li>
</ul>
</div>
</body>
</html>
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
Don't tread on my bandwidth. Trim your posts.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs