Prettyprint - demo1

Ruter i bakgrunnen,tilpasset font og linehøyde. Egen bakgrunn for Python.

CSS on this page

myprettyfy1.css (uten prettyprint)

Javascript

// working with DOM
function copyFragment(fromNode,toNode)
{
   while(toNode.hasChildNodes())
      toNode.removeChild(toNode.lastChild);
   
   nod=fromNode.firstChild;
   while(nod!=null)
   {
      nodcopy=nod.cloneNode(true);
      toNode.appendChild(nodcopy);
      nod=nod.nextSibling;
   }
}
function switchElements(elt1ID,elt2ID)
{
     element1=document.getElementById(elt1ID);
     element2=document.getElementById(elt2ID);
     elementtemp=document.getElementById('temp');
     copyFragment(element1,elementtemp);
     copyFragment(element2,element1);
     copyFragment(elementtemp,element2);
}

Python

#! /usr/bin/python
"""
 Reading fields navn and adresse
 and reports the findings
"""
import cgi
form=cgi.FieldStorage()
print 'Content-type: text/html; charset=iso-8859-1\n'
print form
navn=''
adresse=''
try:
   navn=form['navn'].value
except:
   navn='ukjent'
try:
   adresse=form['adresse'].value
except:
   adresse='ukjent'
print "Dette er det jeg fant: Navn: %s, Adresse: %s"%(navn,adresse)

Python med linjenummer

#! /usr/bin/python
"""
 Reading fields navn and adresse
 and reports the findings
"""
import cgi
form=cgi.FieldStorage()
print 'Content-type: text/html; charset=iso-8859-1\n'
print form
navn=''
adresse=''
try:
   navn=form['navn'].value
except:
   navn='ukjent'
try:
   adresse=form['adresse'].value
except:
   adresse='ukjent'
print "Dette er det jeg fant: Navn: %s, Adresse: %s"%(navn,adresse)

CSS

h1{font-size:24px}
/* table set up */
.tab2 table{font: 11px/24px Verdana, Arial, Helvetica, sans-serif;
          border-collapse:collapse; width: 250px; border:2px solid blue}
.tab2 thead {background-color:yellow;}
.tab2 th{padding: 0 0.5em; text-align:left; border-bottom: 1px solid #CCC;}
.tab2 td{border-bottom: 1px solid #CCC; padding: 0 0.5em;}
.tab2 td+td {border-left: 1px solid #CCC; text-align: left;}
.tab2 td:last-child{text-align: right;}
.tab2 tr:last-child{border-bottom:2px solid blue}