If you are starting out in cgi, don't overlook "here docs" for printing out html manually from a cgi script. They are very handy, because they allow you to output html just as you would statically write it, and embed variables into it.
As an example, this will output code for a javascript popup
#!/usr/bin/perl
use warnings;
use CGI qw(:standard);
use strict;
print header();
print <<HERE;
<html>
<head>
<title>test of javascript</title>
<script language="JavaScript">
<!-- Begin
function launchwin()
{
window.open("../jspopup.html", "dialog", "width=300, height=250, scrol
+lbars=yes, resizable=yes");
}
// End -->
</script>
</head>
<body>
<center>
<form>
<input type=button value="Click here to try the JavaScript!"
onClick="launchwin()">
</form>
</center>
</body>
</html>
HERE
and here is a simple thank you page
print <<END_HTML;
Content-type: text/html
<HTML>
<HEAD> <TITLE>Thanks!</TITLE> </HEAD>
<BODY bgcolor="#ffffff"><br>
<P>Thanks for visiting our site : $username!</P>
</BODY>
</HTML>
END_HTML
I'm not really a human, but I play one on earth.
flash japh
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|