你所在的位置:首 页 >> 特效推荐 >> 详细新闻页面


runCode代码

作者:zhirong1230 创建时间:2012-06-16 阅读次数:2286


<script>
//对代码进行操作
function runCode(obj)
{
var winname = window.open("", "_blank","resizable=yes,scrollbars=yes,status=yes");
winname.document.open("text/html", "replace");
winname.document.writeln(obj.value);
winname.document.close();
}
function saveCode(obj,filename)
{
var winname = window.open("", "", "top=10000,left=10000");
winname.document.open("text/html", "replace");
winname.document.writeln(obj.value);
winname.document.execCommand("saveas", "", filename + ".htm");
winname.close();
}
function copyCode(obj)
{
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
</script>
<textarea name=yingxiao id=yingxiao style=" width:680px; height:208px; border:1px solid #666;"></textarea>
<br />
<input style="background:#E2F2F9;" type=button onclick=runCode(document.getElementById("yingxiao")) value="运行代码">
<input style="background:#E2F2F9;" type=button onclick=copyCode(document.getElementById("yingxiao")) value="复制代码">
<input style="background:#E2F2F9;" type=button onclick=saveCode(document.getElementById("yingxiao"),"运行,复制,保存,run,copy,save,代码") value="保存代码">

提示:您可以先修改部分代码再运行
</div>



    关键词(keywords):runCode代码

分享到: 更多


前一篇: 自动复制代码            后一篇:科学的设计你的网站网页

phpchina   php爱好者   php100    中国网管联盟   LAMP兄弟连   河北联合大学   胜芳趣团网   rss 联系我们 问题反馈
版权所有@:ABCMS新闻发布系统!
建议使用ie6、ie8和 ff 浏览器进行浏览 | 建议分辨率:1024x768
地址:唐山市路北区高新技术产业园区龙华道128号 | 邮编:63000| 邮箱:zhirong1230@yeah.net