当前位置:Gxlcms > JavaScript > 对textarea框的代码调试,而且功能上使用非常方便,酷

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

时间:2021-07-01 10:21:17 帮助过:57人阅读

<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>

人气教程排行