做一个自己的网页编译器

本文介绍了一款简易的网页编译器实现方案,通过整合前人经验并进行适当修改,该编译器能够完成基本的网页代码编辑、预览及保存功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

做一个自己可以编译网页的编译器,我总结了前辈们的代码,自己修改了下
<script>...
<!--
vari=0;
varie=(document.all)?1:0;
varns=(document.layers)?1:0;
//预览
functionpreview()
...{
if(document.pad.text.value.length>0)
...{
pr
=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=480height=320,left=10,top=10");
pr.document.write(document.pad.text.value);
}

elsealert('没有代码可预览!')
}

//保存
functionsavetxt()...{
if(document.pad.text.value.length>0)
...{
varnewwin=window.open('about:blank','','top=10000');
newwin.document.write(document.pad.text.value);
newwin.document.execCommand(
'saveas','','hx66.html')
newwin.window.close();
}

elsealert('没有代码可保存!')
}

//-->
</script>
<bodystyle='cursor:url(skin/mouse.cur)'>
<FORMmethod=postname=pad>
<tablewidth='700'border='0'cellspacing='1'align='center'>
<tr>
<tdValign='TOP'style="LINE-HEIGHT:150%;padding:5;"align='center'>
<TEXTAREAcols=95name=textrows=25>
</TEXTAREA>
</td>
</tr>
<tr>
<tdalign='center'>
<INPUTname=viewonclick=preview()type=buttonvalue=运行onmouseover="this.className='boton'"onmouseout="this.className='botoff'"class="botoff">
<INPUTname=returonclick=savetxt()type=buttonvalue=保存onmouseover="this.className='boton'"onmouseout="this.className='botoff'"class="botoff">
<INPUTname=cleartype=resetvalue=还原onmouseover="this.className='boton'"onmouseout="this.className='botoff'"class="botoff">
</form>
</body>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值