当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 对textarea框的代码调试,而且功能上使用非常方便,酷

Javascript
IE和Firefox在JavaScript应用中的兼容性探讨
在线演示常用javascript特效
Meta 标签生成器
动态生成的IFRAME,设置SRC时的问题解决分析
CSS常用网站布局实例
JS动画效果代码2
JS动画效果代码3
js COL能很好的控制表格的列
readonly和disabled的区别
在CSS里写复杂的JavaScript脚本
用JavaScript操作WinRar
javascript add event remove event
HTML中Select不用Disabled实现ReadOnly的效果
用JavaScript调用WebService的示例
大家未必知道的Js技巧收藏
js批量上传界面的实现
javascript倒计时效果代码,可以方便参数调用
能在网页中写字和能擦写的js程序
javascript背投广告代码的完善
js函数般调用正则

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 318 ::
收藏到网摘: n/a

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