本實例是使用SyntaxHighlighter插件,是在浏覽器客戶端動態的為代碼著色,可以顯示行號.
Javascript代碼著色實例:http:///keleyi/phtml/codecolor/a/index.htm
以下是代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Javascript代碼高亮著色顯行號-</title>
<script type="text/javascript" src="http:///keleyi/phtml/codecolor/a/scripts/shCore.js"></script>
<script type="text/javascript" src="http:///keleyi/phtml/codecolor/a/scripts/shBrushJScript.js"></script>
<link type="text/css" rel="stylesheet" href="http:///keleyi/phtml/codecolor/a/styles/shCoreDefault.css"/>
<script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body style="background: white; font-family: Helvetica">
<h1>Javascript代碼高亮著色顯行號</h1>
<pre class="brush: js;">
function KeleyiColor()
{
document.write('');
return "hi!";
}
</pre>
</body>
</html>
歷史版本:
http:///keleyi/phtml/codecolor/index.htm