HTML Document
By default, AppJet gives you a complete HTML document with a head
and body. Anything you print goes into the body of the document.
You can easily include CSS and client-side JavaScript using AppJet
code sections:
print(DIV({className:"funky"}, "Frickin' laser beams."));
.funky {
border: 2px dashed red;
color: green;
text-align: center;
font-size: 200%;
background: #ffc;
}
alert("Prepare yourself for my funky page!");
printp("And sharks.");
Note that the beginning of your code is implicitly "appjet:server",
but you can use this label explicitly to return to the server side in
a later section.
Another way to interact with the existing document is to use the
global page object.
page.setTitle("A Potentially Colorful Page");
page.head.write("""
<style>
h1, a { background: white; padding: 0.5em; }
body { background: """+request.query+""" }
</style>
""");
print(H1("This page comes in different colors."));
printp(link("/?red","Red"));
printp(link("/?green","Green"));
printp(link("/?blue","Blue"));
Above you can see how to set the title and write HTML to the head
of the document programmatically.
You can use page.setMode("plain") to bypass the default
document structure and take control of the whole page.
page.setMode("plain");
print(raw("""
<html>
<head>
<title>My Simple Page</title>
</head>
<body>
<center>I'm the <center> of the attention!</center>
</body>
</html>
"""));