110,545
社区成员
发帖
与我相关
我的任务
分享
wbShow.Document.Body.InnerHtml = sb.ToString();
wbShow.Document.InvokeScript("prettyPrint");
意思是重新加载这个方法,就可以实现内嵌HTML时再加载自己要加载的JS。不过,如果是引用JS文件的话,我没有好的办法。用SyntaxHighlighter着色的话,SyntaxHighlighter.all();这个方法调用不成功,写法如下:
function initMenu() {
SyntaxHighlighter.config.clipboardSwf = 'plugins/code/clipboard.swf';
SyntaxHighlighter.all();
alert("wq");
}
code=csharp]wbShow.Document.InvokeScript("initMenu");[[/code]
JS是执行了,最后也弹出wq,但就是不着色。单独出来是着色的,估计是.all这样写是不行的。谢谢大家!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="plugins/code/prettify.css" />
<script type="text/javascript" charset="utf-8" src="kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="zh_CN.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/code/code.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/code/prettify.js"></script>
<script type="text/javascript">
var editor;
KindEditor.ready(function (K) {
editor = K.create('textarea[name="content"]', {
cssPath: 'plugins/code/prettify.css',
allowFileManager: true,
fullscreenMode: true
});
prettyPrint();
});
</script>
</head>
<body>
</body>
</html>
// 弹出网页源文件
System.Windows.Forms.Form windowBrowserSource = new System.Windows.Forms.Form();
System.Windows.Forms.RichTextBox browserSourceText = new System.Windows.Forms.RichTextBox();
browserSourceText.Margin = new System.Windows.Forms.Padding(0);
browserSourceText.Dock = System.Windows.Forms.DockStyle.Fill;
browserSourceText.Text = wbShow.DocumentText;
windowBrowserSource.Controls.Add(browserSourceText);
windowBrowserSource.Show();
看看与IE的查看源文件有什么不一样的么?
编码是否一致,是否有乱码?
有些时候标签未闭合也可能会出现一些错误,貌似IE有自动纠正功能,webbrowser没有。