Use ASP to do a notepad editor (with source code)

Source: Internet
Author: User
Tags generator save file visual studio
Newdoc.asp
----------------------------------------------------------
<%@ Language=vbscript%>
<script id=debugdirectives Runat=server language=javascript>
Set this 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>asp notepad</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>document:<b> <%=request.querystring ("Doc")%></b></font>
<%else%>
<font face=arial size=2>document:<b> untitled</b></font>
<%
End If%>
</TD>
</TR>
</TABLE>
<p><select id=select1 name=select1 style= "HEIGHT:22PX; width:25% ">
<option value= ' Times New Roman ' >times new roman</option>
<option value= ' System ' >System</option>
<option value= ' Arial ' >Arial</option>
<option value= ' comic Sans MS ' >comic Sans
<option value= ' Courier ' >Courier</option>
<option value= ' Courier New ' >courier new</option>
<option value= ' Verdana ' >Verdana</option>
</SELECT>
<input id=button2 name=button2 Type=button value=font>
<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=size>
<input id=button4 name=button4 Type=button value=bold>
<input id=button5 name=button5 Type=button value=italics>
<input id=button6 name=button6 Type=button value= ' Close Window ' ><BR><BR>
<font face=arial Size=1>you won't is questioned on saving the changes</p></font>
<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=" Save File >
<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 ("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 "<???? > No document Exists <???? > "
End If
End If
%>
</TEXTAREA>
</form>

</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><strong>asp
Notepad</strong></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=open style= "HEIGHT:24PX; width:65px "
Language=javascript > <input id=new name=new style= "HEIGHT:24PX;
width:64px "Type=submit value=new language=javascript >
<input id=button2 name=button2 style= "HEIGHT:24PX; width:74px "Type=button value=exit
Language=javascript ></P>

</form>
<P> </P>
<P>
<HR>
<font face=arial size=2><strong>author: </strong><font Color=royalblue>sharon
Jayaraj<br></font><strong>platform<font Color=lightseagreen>:
</font></strong><font color=lightseagreen>win98</font><br><strong> Application
Used: </strong><font color=orange>interdev</font><font color=lightpink> (for easy
Working) </font>and <font Color=orange>pws</font><font color=lightpink> (for
Testing) </FONT></FONT></P>

</BODY>
</HTML>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.