天天看点

代码预览器

代码预览器代码:

<meta http-equiv='Content-Type' content='text/html; charset=gb2312'> 

<SCRIPT> 

function runEx(){ 

var winEx2 = window.open("", "winEx2",""); winEx2.document.open("text/html", "replace"); 

winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value)); 

winEx2.document.close(); 

function saveFile() 

var win=window.open('','','top=10000,left=10000'); 

win.document.write(document.all.asdf.innerText) 

win.document.execCommand('SaveAs','','copy.htm') 

win.close(); 

</SCRIPT> 

<SCRIPT language=JavaScript> 

<!-- 

function MM_goToURL() { //v3.0 

var i, args=MM_goToURL.arguments; document.MM_returnValue = false; 

for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); 

function JM_cc(ob){ 

var obj=MM_findObj(ob); if (obj) { 

obj.select();js=obj.createTextRange();js.execCommand("Copy");} 

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; 

//--> 

</head> 

<BODY leftMargin=0 topMargin=0> 

<TABLE cellSpacing=0 width="100%" border=0 background="images/lgb.gif" height="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0"> 

<TR> 

<TD height="1"> 

<FORM action="" method=post name=form1> 

<TEXTAREA id=asdf name=textfield rows=25 cols="91"></TEXTAREA> 

<BR> 

<INPUT name=Button type=button value=预览效果 style="background-color: #FFFFFF"> 

<INPUT name=Button onclick=asdf.select() type=button value=全选代码 style="background-color: #FFFFFF"> 

<INPUT name=Button onclick="asdf.value=''" type=button value=清空代码 style="background-color: #FFFFFF"> 

<INPUT name=Button onclick="JM_cc('textfield')" type=button value=复制代码 style="background-color: #FFFFFF">

<INPUT type=button value=保存代码 style="background-color: #FFFFFF"> 

<INPUT a href="#" onclick="window.open('http://www.mlhd.org/myblog')" type=button value=特效首页 style="background-color: #FFFFFF"></a> 

<INPUT onclick="self.close()"< /font> type=button value=关闭窗口 style="background-color: #FFFFFF"></DIV> </TD></TR> 

</table> 

</body> 

</html> 

本文转自 yeybz 51CTO博客,原文链接:http://blog.51cto.com/hmlwl/1168090

继续阅读