SyntaxHighlighter demo

A simple example to illustrate how to use SyntaxHighlighter. The source code of this demo is here.

A piece of Java Code

      
package org.man.tapestry5.components;

import org.apache.tapestry.annotations.Environmental;

/**
 * This component is to be ues with CheckboxGroup and ControlCheckbox.
 * Select all the ControlledCheckboxes by checking this control checkbox.
 * @author Shing Hing Man
 *
 */
public class ControlCheckbox {
	
	@Environmental
	private CheckboxContainer checkboxContainer;
	
	public String getOnclickStr(){
		String str = checkboxContainer.getFunctionName() + "(this.checked)";
		return str;
	}
}

A Piece of Html

 
    <html>
<head>
 <title></title>
  <meta name="GENERATOR" content="Quanta Plus">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
   Hello world !
</body>
</html>
	

A Piece of JavaScript

 function tp_toggle(contentId, arrowId, openedIcon, closedIcon, effect)
{

 if ( $(contentId).visible()) {
 // From visible to invisible
 $(arrowId).src = closedIcon;
 }
 else {
 $(arrowId).src = openedIcon;
 }

 Effect.toggle(contentId,effect,{duration:1})

}
    	

A Piece of CSS

 div.t-error {
border:1px solid red;
margin:4px 0px;
padding:0px;
}
div.t-error div {
background-color:red;
color:white;
display:block;
font-weight:bold;
margin:0px;
padding:2px;
}
div.t-error ul {
background-color:white;
color:red;
margin:2px 0px;
}
div.t-error li {
margin-left:-20px;
}
	

A Piece of Sql

 CREATE TABLE my_table (
  my_field1   INT,
  my_field2   VARCHAR (50),
  my_field3   DATE         NOT NULL,
  PRIMARY KEY (my_field1, my_field2) 
);