Log in

View Full Version : trying to view AND edit txt within in a webpage



pdsok
03-06-2008, 10:50 AM
Hi
I am trying to create a page which will show some small info about a topic when it is clicked on, using a div or iframe, but i would also want to be able to edit and save the info.

an example would be a list of names, click one of the names and an address would show in a small window (a div or iframe) on the page But I would want to edit the address info either by clicking it to load the .txt file in, say, notepad or to edit it direct on the page itself.

this is all stored on a local pc and not for web use

Is this possible at all or am I asking too much

thanks

codeexploiter
03-07-2008, 06:57 AM
http://www.quirksmode.org/dom/cms.html

For saving the edited content permanently you have to use server-side tool even some db

pdsok
03-07-2008, 11:32 AM
For saving the edited content permanently you have to use server-side tool even some db

Thanks for the reply, I thought that would be the case.
I did see that page when I googled around before posting the question, but I kinda hoped there would be a nice simple html & java solution without the db, php, cgi, perl or all the other things I know nothing about. :)

Is there any way to open a .txt file in notepad from html/java etc?
I'm just trying to keep it quick clean and simple

thanks
PdS

Master_script_maker
03-07-2008, 12:19 PM
java, yes. javascript, no.

pdsok
03-10-2008, 08:24 PM
I know that java is very different to javascript & jscript.
I do not really know Java and unfortunately I'm not a competent coder by any means
Ive been using (or trying to use) this but it just won't work


<script language="jscript" type="text/jscript">
/***** Original script****
{
var objShell = new ActiveXObject("Shell.Application");

objShell.ShellExecute("notepad.exe", "", "", "open", 1);
}
*/

Function EditEntry(FileName)
{
var ProgName = "Notepad.exe";
var ObjShell = new ActiveXObject("Shell.Application");
ObjShell.ShellExecute(ProgName, FileName, "", "Open", "1");
}
</script>
</head>
<body>
<form>
<input name="EditButton" type="button" id="EditButton"
onclick="EditEntry('test.txt')"
value="Edit Entry">
</form>

I also found this which actually works but I am struggling to make it work as I want it to (the .txt file is in the same folder as the html file).


<script>
var ObjShell = new ActiveXObject("WScript.Shell");
function runNotepad()
{
if (window.ActiveXObject) {
var AppParms = document.getElementById('file').value;
ObjShell.run ("notepad.exe " + AppParms, "1");
} else
alert("You browser doesn\'t support this feature");
}
</script>
</HEAD>
<BODY>
<p>
<input type="text" id="file" value="test.txt">
<input type="button" value="Run Notepad" onClick="runNotepad()">

also it is only ie and i would need to work in FireFox.

This was supposed to be a quick easy way to read info about various machines and edit the info if required without any knowledge AND to be portable eg on a stick from PC to PC hence the idea of using script/ html.

If this is possible I'd appreciate some help but if its one of those 'looks simple but by god it ain't' scenarios then we'll go back to pen n paper and to hell with technology :D

Thanks
PdS