Home : programming : racket

Racket table

How to create a table in a web server.

In order to create a table that looks like this:
table pic
you need the following code:

#lang web-server/insta

(define (start request)
  `(html (head (title "Table test"))
         (body 
          
          (h1 "Example 1")
          (p "The most basic of tables:")
          (table (tbody
                  (tr (td "one") (td "two"))
                  (tr (td "three") (td "four"))))
          
          (h1 "Example2")
          (p "Let's add some attributes: a table border, some cell spacing, and a width and background colour to one of the cells:")
          (table ((border "1") (cellspacing "10"))                  
                 (tbody
                  (tr (td ((width "100") (bgcolor "#FF6699")) "one") (td "two"))
                  (tr (td "three") (td "four")))))))

Author:  Mark Carter
Created: 29-Dec-2010
Updated: 29-Dec-2010