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

Javascript
JavaScript 拖拽实现(附注释),最经典简单短小精悍!
学习drag and drop js实现代码经典之作
jquery创建div 实现代码
jquery遍历input取得input的name
jQuery 对象中的类数组操作
js 发个判断字符串是否为符合标准的函数
细品javascript 寻址,闭包,对象模型和相关问题
在IE上直接编辑网页内容的js代码(IE地址栏js)
一个选择最快的服务器转向代码
JQUERY 对象与DOM对象之转换
javascript 对象比较实现代码
jquery 获取json数据实现代码
Firefox div高度自适应
xml和web特殊字符
js 表单验证方法(实用)
ie和firefox不兼容的解决方法集合
js 数组操作代码集锦
js checkbox(复选框) 使用集锦
JS 判断代码全收集
理解JavaScript的caller,callee,call,apply

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 313 ::
收藏到网摘: 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>