0
我在我的asp.net应用程序中使用JQuery语法高亮显示。JQuery语法高亮片段
http://www.steamdev.com/snippet/
我已经包含了脚本和CSS文件在使用一节中提到。
而且下面的代码:
<script>
$(document).ready(function(){ $("pre.htmlCode").snippet("html");
// Finds <pre> elements with the class "htmlCode"
// and snippet highlights the HTML code within.
$("pre.styles").snippet("css",{style:"greenlcd"});
// Finds <pre> elements with the class "styles"
// and snippet highlights the CSS code within
// using the "greenlcd" styling.
$("pre.js").snippet("javascript",{style:"random",transparent:true,showNum:false});
// Finds <pre> elements with the class "js"
// and snippet highlights the JAVASCRIPT code within
// using a random style from the selection of 39
// with a transparent background
// without showing line numbers.
});
</script>
<script>
$(document).ready(function(){
$("pre#dynamic").snippet("php",{style:"navy",clipboard:"js/ZeroClipboard.swf",showNum:false});
// Highlights a snippet of PHP code with the "navy" style
// Hides line numbers
$("pre#dynamic").click(function(){
$(this).snippet({style:"vampire",transparent:true,showNum:true});
// Changes existing snippet's style to "vampire"
// Changes the background to transparent
// Shows line numbers
});
});
</script>
结果:我得到的代码段像下面
但代码是从荧光笔走出去,我也没有别的选择复制剪贴板。
如何将其添加到我的页面?
插入数据时,我只使用<pre></pre>
标签。我需要在预先指定语言吗?因为我还没有得到的颜色代码
编辑
我打电话下面
<link href="jquery.snippet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=ResolveUrl("~/JS/jquery.snippet.js")%>" ></script>
EDIT1
正是在降级模式一样的JS和CSS文件当我点击“文本”链接时,我可以看到所有的格式都消失了。任何建议如何保持扩展格式的HTML模式?
@大卫肯普我试过相同的我保持像
但结果是一样的。我错过了什么吗? – Chris 2011-03-24 13:44:44@Chris - 我已经为你修改了我的答案 – 2011-03-24 13:50:05
@David Kemp感谢David,现在工作正常。但我有另一个问题,请检查编辑1部分。 – Chris 2011-03-24 14:16:39