本实例是使用Javascript插件,在浏览器客户端动态的为代码着色,可以显示行号.

Javascript代码着色实例效果:http://www.keleyi.com/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://www.keleyi.com/keleyi/phtml/codecolor/a/scripts/shCore.js"></script>
<script type="text/javascript" src="http://www.keleyi.com/keleyi/phtml/codecolor/a/scripts/shBrushJScript.js"></script>
<link type="text/css" rel="stylesheet" href="http://www.keleyi.com/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('keleyi.com');
return "hi!";
}
</pre>
</body>
</html>

 

历史本:
http://www.keleyi.com/keleyi/phtml/codecolor/index.htm

posted on 2013-05-29 16:52  计划  阅读(1703)  评论(0编辑  收藏  举报