做一个自己可以编译网页的编译器,我总结了前辈们的代码,自己修改了下
<script>...
<!--
var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;
// 预览
function preview()
...{
if(document.pad.text.value.length>0)
...{
pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=480 height=320,left=10,top=10");
pr.document.write(document.pad.text.value);
}
else alert('没有代码可预览!')
}
// 保存
function savetxt() ...{
if(document.pad.text.value.length>0)
...{
var newwin=window.open('about:blank','','top=10000');
newwin.document.write(document.pad.text.value);
newwin.document.execCommand('saveas','','hx66.html')
newwin.window.close();
}
else alert('没有代码可保存!')
}
// -->
</script>
<body style='cursor:url(skin/mouse.cur)'>
<FORM method=post name=pad>
<table width='700' border='0' cellspacing='1' align='center'>
<tr>
<td Valign='TOP' style="LINE-HEIGHT: 150%;padding: 5;" align='center'>
<TEXTAREA cols=95 name=text rows=25>
</TEXTAREA>
</td>
</tr>
<tr>
<td align='center'>
<INPUT name=view onclick=preview() type=button value=运行 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
<INPUT name=retur onclick=savetxt() type=button value=保存 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
<INPUT name=clear type=reset value=还原 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
</form>
</body>
<!--
var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;
// 预览
function preview()
...{
if(document.pad.text.value.length>0)
...{
pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=480 height=320,left=10,top=10");
pr.document.write(document.pad.text.value);
}
else alert('没有代码可预览!')
}
// 保存
function savetxt() ...{
if(document.pad.text.value.length>0)
...{
var newwin=window.open('about:blank','','top=10000');
newwin.document.write(document.pad.text.value);
newwin.document.execCommand('saveas','','hx66.html')
newwin.window.close();
}
else alert('没有代码可保存!')
}
// -->
</script>
<body style='cursor:url(skin/mouse.cur)'>
<FORM method=post name=pad>
<table width='700' border='0' cellspacing='1' align='center'>
<tr>
<td Valign='TOP' style="LINE-HEIGHT: 150%;padding: 5;" align='center'>
<TEXTAREA cols=95 name=text rows=25>
</TEXTAREA>
</td>
</tr>
<tr>
<td align='center'>
<INPUT name=view onclick=preview() type=button value=运行 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
<INPUT name=retur onclick=savetxt() type=button value=保存 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
<INPUT name=clear type=reset value=还原 onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff">
</form>
</body>