当前位置: 首页 > 图文教程 > 网络编程 > Javascript > csdn 博客中实现运行代码功能实现

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 csdn 博客中实现运行代码功能实现


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 305 ::
收藏到网摘: n/a

有时候因为csdn的博客经常处理一些字符,导致代码很多情况下,都不能正常运行,给大家的阅读带来了麻烦,下面是软晨学习网编辑简单的整理下。 因为没有运行功能,所以想在页面中实现运行代码功能,下面的代码是个不错的实现方法,当然你也可以任何你想实现代码运行功能的地方使用。
复制代码 代码如下:

<p>
<script type="text/javascript"><!--
function viewPage(html) {
var page = window.open('', '', '');
page.opener = null;
page.document.write(html);
page.document.close();
}
// --></script>
<a href="javascript:viewPage(document.getElementsByTagName('textarea')[0].value)">运行代码</a></p>

看csdn的博客中的代码是越来越麻烦了
如果需要正常的阅读,需要如下操作
1、一般需要替换的地方有
如果代码中函数 src href的地方,都要注意。