当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 对textarea框的代码调试,而且功能上使用非常方便,酷

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

2019年07月31日  | 移动技术网IT编程  | 我要评论

<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=gb2312'>
<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>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网