这个其实在后台编辑器里面就有这个功能,不过平时用到的时候总不能老是翻代码,所以学会记住,随时自己写一个出来用着方便
直接帖代码重点代码已经加红
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">// <![CDATA[
function runCode(id) {
var myWin = window.open('', '_blank', '');
var t = document.getElementById(id).value;
myWin.document.open('text/html', 'replace');
myWin.opener = null;
myWin.document.write(t);
myWin.document.close();
}
// ]]></script>
</head>
<body>
<textarea id="runCode" class="test" style="height: 330px; width: 750px; margin-left: 25px;">
<head>
<title >
</title>
<style type="text/css">
</style>
<script type="text/javascript">
</script>
</head>
<body >
</body>
</textarea>
<input onclick="runCode('runCode')" type="button" value="运行代码" />
</body>
</html>
版权所有:有信心——uxinxin 我的个人网站欢迎常来!手机版(新站开启,请多多关照) 豫ICP备12017930号-1
豫公网安备 41910102000493号