设为首页 | 加入收藏 | 
可以运行JavaScript和Html代码的JS代码[支持IE和FF]
作者:叶随风 时间:05月28日 来源:http://www.popasp.com/ 浏览次数:【字号: 】 

  主要功能,可以在线运行调试JavaScript或者Html的代码。

  运行后,可以将JavaScript或者HTML代码粘贴到文本域内调试运行。编辑区的文本域可以动态调整高度和宽度。

  有任何问题探讨:请加QQ群:50076462

泡泡ASP相关代码:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>可以运行JS和HTML代码的JS代码[支持IE和FF]</title>
</head>
<body>
<script type="text/JavaScript">
<!--
/*******************************************
 功能:可以运行JS和HTML代码的JS代码
 叶随风(LeafinWind)
 QQ:19855466
 http://www.popasp.com/
********************************************/
//运行文本域代码
function runCodes(str)
{
 //获取文本域的值
 var code = document.getElementById(str).value;
 if (code != "")
 {
  //打开一个窗口并赋给变量newwin。
  var newwin = window.open(’’,’’,’’); 
  newwin.opener = null;
  //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
  newwin.document.write(code);
  newwin.document.close();
 }
 else
 {
  alert("请输入要运行的代码!");
 }
}
//增加高度
function addHeight(str)
{
 document.getElementById(str).rows = document.getElementById(str).rows + 10;
}
//减小高度
function subHeight(str)
{
 if (document.getElementById(str).rows > 10)
  document.getElementById(str).rows = document.getElementById(str).rows - 10;
}
//增加宽度
function addWidth(str)
{
 document.getElementById(str).cols = document.getElementById(str).cols + 10;
}
//减小宽度
function subWidth(str)
{
 if (document.getElementById(str).cols > 60)
  document.getElementById(str).cols = document.getElementById(str).cols - 10;
}
//-->
</script>
<div style="font-weight:bold;font-size:14px;margin:5px;">泡泡ASP JavaScript And Html 代码运行页</div>
<div>
<textarea name="codes" cols="60" rows="10" id="codes"><font color="red">请输入您要运行的JavaScript或HTML代码</font></textarea>
</div>
<div style="margin:5px;">
<INPUT onclick="runCodes(’codes’);" type="button" value="运行代码">
<INPUT onclick="addHeight(’codes’);" type="button" value="增加高度">
<INPUT onclick="subHeight(’codes’);" type="button" value="减小高度">
<INPUT onclick="addWidth(’codes’);" type="button" value="增加宽度">
<INPUT onclick="subWidth(’codes’);" type="button" value="减小宽度">
</div>
<div style="font-size:12px;margin:5px;color:#FF0000">[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]</div>
</body>
</html>

 * 以上任何内容或信息侵犯了你的利益,请及时联系!
泡泡搜索
最新文章
热点文章
精彩推荐
 - TOP