当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何制作一个文本文件编辑器?

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

2017年12月08日  | 移动技术网IT编程  | 我要评论
newdoc.asp<%@ language=vbscript %><script id=de

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> 
  <input id=button2 name=button2 type=button value=
字体
  <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> 
  <input id=button3 name=button3 type=button value=
字号
  <input id=button4 name=button4 type=button value=
粗体
  <input id=button5 name=button5 type=button value=
斜体
  <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")%>> 
<input id=button1 name=button1 style="height: 24px; width: 15%" type=submit value="
保存文件" > 
<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]

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网