HI,
I have a list of commands on a help page and new commands are constantly added. I want to put in a delete button so you can remove this file from the list..any ideas??
Not sure what you mean, but it sounds like you want JavaScript to write/update a file - which it cannot do. Consider using a server-side technology: ASP, PHP, Perl, ColdFusion, JSP, etc...
I am using ASP.
This is the page that goes on to open my list of server commands..(used a bit of VB script here too)
<% @LANGUAGE="VBSCRIPT" %>
<%
'*** create fso object
dim objFSO
set objFSO = createobject("scripting.filesystemobject"
'***----
'*** define the location of your homepage from here
'*** this will be used after updating or cancelling
dim stHomePage
strHomePage = "Template.html"
Dim commandFile
commandFile = "server_config.asp"
'***---
'*** get the name of this page (script) dynamically - you could specify this if you want
dim strScriptName
strScriptName = request.servervariables("script_name"
strScriptName = mid(strScriptName, instrrev(strScriptName, "/" + 1 )
'***---
'***--- if they've not submitted the Save form
if request.form("Save" = "" then
Dim Regex, title
Set Regex=New RegExp
Regex.Global = True
Regex.IgnoreCase = False
Regex.Multiline = True
Regex.Pattern="(EXAMPLE*|Example|DESCRIPTION|SYNOPSIS|OPTIONS|#\d+|\$\s+\w*\s\w*)"
'***---- if they're updating....
else if request.form("Save" <> "" then
'*** get the contents
dim strWriteContents
strWriteContents = request.form("pageHTML"
'*** page text isn't a requirement as we can sort out an error message to some extent in replace.
if strWriteContents = "" then
strWriteContents = "This page is currently un-available."
strWriteContents = strNewContent & vbCrLf & "<br><br>"
strWriteContents = strNewContent & vbCrLf & "We apologise for any inconvenience caused."
end if
Dim objMenuPage, i
objFile = Request.form("fileName"
if(objFSO.FileExists(Server.MapPath(objFile) ) )Then
strFileContents = strWriteContents
error = "The file "& objFile &" already exists. please specify a different file name"
else
Const ForReading = 1, ForWriting = 2, ForAppending = 8
'write the HTML page
objMenuPage.WriteLine"<html><head><title>" & Request.Form("pageTitle"& "</title></head><body>"
objMenuPage.WriteLine strWriteContents
objMenuPage.WriteLine "</body></html>"
objMenuPage.Close
'Add the link to the command file
Dim f,ts
set f = objFSO.GetFile(Server.MapPath(commandFile))
set ts = f.OpenAsTextStream(ForAppending, -2)
'Write the link and specify how you want it to look. All "" in ther html code must be changed to ''
ts.write("<font size='3'><a href ='" & objFile &"'>" & objFile & "</a></font><br>"
Response.Redirect(commandFile)
end if
end if
End if
%>
<html>
<head>
<title>Text Editor</title>
<script language="javascript">
<!--
function over(element) {
element.style.borderStyle= "solid";
element.style.borderWidth = "1px";
element.style.borderColor = "#000000";
element.style.backgroundColor = "#F1F1F1";
element.style.cursor = "hand";
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.