欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

对textarea框的代码调试,而且功能上使用非常方便,酷

程序员文章站 2022-06-29 09:16:39
<title>对textarea框的代码调试,而且功能上使用非常方便,酷</title>
</head>
<body >

<script>function jm_cc(ob){
ob.select();js=ob.createtextrange();js.execcommand("copy");
}</script>
<table cellspacing=0 cellpadding=0 width="99%" border=0>
 <tbody>
 <tr>
 <td align=middle width="100%">代码说明</td></tr>
 <tr>
 <td align=middle width="100%"></td></tr></tbody></table>
<form action=--webbot-self---------------- method=post>
<div align=center>
<center><textarea name=txt rows=20 cols=65></textarea></center><br></div>
<center><table cellspacing=0 cellpadding=0 border=0>
 <tbody>

 <tr bgcolor=#f0fff0>
 <td align=middle width="17%"><font color=#004080><input onclick=javascript:this.form.txt.focus();this.form.txt.select(); type=button value="代 码 全 选"></font></td>
 <td align=middle width="17%"><input onclick="window.open('view-source:file:///c:/windows/autoexec.bat','_self')" type=button value=使用记事本></td>
 <td align=middle width="20%"><font color=#004080><input id=flashit onclick=test() type=button value=调试运行本代码 name=tryit></font></td>
 <td align=middle width="21%"><font color=#004080><input onclick=jm_cc(txt) type=button value=直接复制到剪贴板></font></td>
 </tr>
 </tbody></table>
<table width="100%">
 <div align=center>
 <center></div>
 <tbody></tbody></table></center>

<script language=javascript1.2>
function mm_findobj(n, d) { //v4.0
 var p,i,x; if(!d) d=document; if((p=n.indexof("?"))>0&&parent.frames.length) {
 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findobj(n,d.layers[i].document);
 if(!x && document.getelementbyid) x=document.getelementbyid(n); return x;}
function test(){
obj=mm_findobj('txt');
if (obj.value.length<1) {alert("请输入代码后按运行!");obj.focus();}
else{
var winex = window.open("", "winex", "width=400,height=400,status=yes,menubar=yes,scrollbars=yes,resizable=yes"); winex.document.open("text/html", "replace");
winex.document.write(obj.value);
winex.document.close();}} 
if (document.all&&document.all.flashit){
var flashelement=document.all.flashit
if (flashelement.length==null)
flashelement[0]=document.all.flashit
function changecolor(which){
if (flashelement[which].style.color=='')
flashelement[which].style.color="#ff8040"
else
flashelement[which].style.color=""}
if (flashelement.length==null)
setinterval("changecolor(0)",1000)
else
for (i=0;i<flashelement.length;i++){
var tempvariable='setinterval("changecolor('+i+')",'+'1000)'
eval(tempvariable)}}
</script>

</body></html>