当前位置: 代码网 > it编程>编程语言>其他编程 > 如何制作一个文本文件编辑器?

如何制作一个文本文件编辑器?

2024年05月19日 其他编程 我要评论
newdoc.asp<%@ language=vbscript %><script id=debugdirectives runat=server language=java

newdoc.asp
<%@ language=vbscript %>
<script id=debugdirectives runat=server language=javascript>
//set these to true to enable debugging or tracing
@set @debug=false
@set @trace=false
</script>
<html>
<head>
<meta name=vi60_defaultclientscript content=vbscript>
<meta name="generator" content="microsoft visual studio 6.0">

<script id=clienteventhandlersvbs language=vbscript>
<!--

sub button2_onclick
fo1.textarea1.style.fontfamily=select1.value
end sub

sub button3_onclick
fo1.textarea1.style.fontsize=select2.value
end sub

sub button4_onclick
if button4.value="bold" then
button4.value="un bold"
fo1.textarea1.style.fontweight="bold"
else
button4.value="bold"
fo1.textarea1.style.fontweight="normal"
end if
end sub

sub button5_onclick
if button5.value="italics" then
button5.value="un italics"
fo1.textarea1.style.fontstyle="italic"
else
button5.value="italics"
fo1.textarea1.style.fontstyle="normal"
end if
end sub
sub button6_onclick
window.close
end sub

-->
</script>
</head>
<body>
<font face=arial size=3 color=royalblue><b>
撼雪喷云之文本文件编辑器</b></font>
<%dim x
if request("type")="save" then
x = 1
end if
%>
<object id=object1 progid="scripting.filesystemobject" runat="server"> </object>
<table bgcolor=blanchedalmond border=0 cellpadding=1 cellspacing=1  width="100%">
  <tr>
    <td>
    <% if not len(request("doc"))=0 then%>
    <font face=arial size=2>
文档:<b> <%=request.querystring("doc")%></b></font>
    <%else%>
    <font face=arial size=2>
文档:<b>未命名</b></font>
    <%
    end if%>
    </td>
  </tr>
</table>
<p><select id=select1 name=select1 style="height: 22px; width: 25%">
<option value='simsun'>
宋体</option>
<option value='simhei'>
黑体</option>
<option value='simli'>
隶书</option>
<option value='stxinwei'>
华文新魏</option>
<option value='gpopo3e'>
文鼎中特广告体</option>
<option value='times new roman'>times new roman</option>
<option value='system'>system</option>
</select>&nbsp;
  <input id=button2 name=button2 type=button value=
字体>&nbsp;
  <select id=select2 name=select2 style="height: 22px; width: 60px">
<option value=8pt>8pt</option>
<option value=9pt>9pt</option>
<option value=10pt selected>10pt</option>
<%for a=11 to 100%>
<option value='<%=a%>pt'><%=a%>pt</option>
<%next
%>
</select>&nbsp;
  <input id=button3 name=button3 type=button value=
字号>&nbsp;
  <input id=button4 name=button4 type=button value=
粗体>&nbsp;
  <input id=button5 name=button5 type=button value=
斜体>&nbsp;
  <input id=button6 name=button6 type=button value='
关闭窗口'><br><br>
<form id=fo1 name=fo1 method=post action=newdoc.asp?type=save&ch=1&doc=<%=request.querystring("doc")%>>
<input id=text1 name=text1 style="height: 24px; width: 80%" value=<%=request.querystring("doc")%>>&nbsp;
<input id=button1 name=button1 style="height: 24px; width: 15%" type=submit value="
保存文件" >&nbsp;
<hr width="100%">
<br>
<textarea id=textarea1 name=textarea1 style="font-family: arial; font-size: 10pt; height: 50%; width:
100%"><%if request("ch")=1 then
response.write request("textarea1")
end if
if len(request("text1"))>0 then
if object1.fileexists(request("text")) then
object1.opentextfile(request("doc")).write request("textarea1")
else
object1.createtextfile (request("text1"),true).write request("textarea1")
end if
end if
if not request.querystring("doc")="" and not request("ch")=1 then
if object1.fileexists(request.querystring("doc")) then
response.write object1.opentextfile(request.querystring("doc")).readall
else
response.write "
,没有文件存在!"
end if
end if
%>
</textarea>
</form>
<hr width="100%">
</body></html>

aspnp.asp
<%@ language=vbscript %>
<html>
<head>
<meta name="generator" content="microsoft visual studio 6.0">
<script id=clienteventhandlersjs language=javascript>
<!--

function submit1_onclick() {
if(frm1.file1.value==null)
window.open("newdoc.asp?doc=" + document.frm1.file1.value);
}

function button2_onclick() {
window.close()
}

function new_onclick() {
window.open("newdoc.asp?doc=");
}

//-->
</script>
</head>
<body>
<form name=frm1>
<p align=left><font color=royalblue face=arial>
撼雪喷云之文本文件编辑器</font></p>
<p align=center>

<input id=file1 name=file1 type=file checked readonly style="height: 22px; left: 55px; top: 16px; width: 100%"><br><br>
<input id=submit1 name=submit1 type=submit value=
打开 style="height: 24px; width: 65px" language=javascript onclick="return submit1_onclick()">

<input id=new name=new style="height: 24px; width: 64px" type=submit value=新建 language=javascript onclick="return new_onclick()">
<input id=button2 name=button2 style="height: 24px; width: 74px" type=button value=
退出 language=javascript onclick="return button2_onclick()"></p>

</form>
</body></html>

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com