这是放在body的引用方法,用了一个循环来判断加载哪个js文件(使用了jq)。
<link rel="stylesheet" type="text/css" media="all" href="/css/familiar.css" /> <link rel="stylesheet" type="text/css" media="all" href="/css/SyntaxHighlighter/shCore.css" /> <link rel="stylesheet" type="text/css" media="all" href="/css/SyntaxHighlighter/shThemeDefault.css" /> <script type="text/javascript" src="/js/SyntaxHighlighter/shCore.js"></script> <script type="text/javascript" src="/js/SyntaxHighlighter/shAutoloader.js"></script> <script type="text/javascript"> function path() { var args = arguments, result = []; for (var i = 0; i < args.length; i++) result.push(args[i].replace('@', '/js/SyntaxHighlighter/')); return result }; $(document).ready(function () { SyntaxHighlighter.autoloader.apply(null, path( 'applescript @shBrushAppleScript.js', 'scala @shBrushScala.js', 'sql @shBrushSql.js', 'vb vbnet @shBrushVb.js', 'xml xhtml xslt html @shBrushXml.js' )); SyntaxHighlighter.defaults['smart-tabs'] = true; SyntaxHighlighter.defaults['tab-size'] = 4; SyntaxHighlighter.all(); }); </script>