¶ Edit

X Delete


7 years ago

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."));

/* appjet:css */

.funky {
    border: 2px dashed red;
    color: green;
    text-align: center;
    font-size: 200%;
    background: #ffc;

/* appjet:client */

alert("Prepare yourself for my funky page!");

/* appjet:server */

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");

  h1, a { background: white; padding: 0.5em; }
  body { background: """+toHTML(request.query)+""" }

print(H1("This page comes in different colors."));


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.


    <title>My Simple Page</title>
    <center>I'm the <center> of the attention!</center>
Powered by AppJet on JGate
rendered in 0.106s