0

I am writing a website and I have a very basic understanding of JavaScript (JS) but a good understanding of HTML and CSS. I want to have an admin part of the website were you can edit the content of the site. I also need help on how to display these text files onto the website using JS. Thank you for your help.

4
  • standard JS has no file operations whatsoever. there's web storage, but that's not what you're looking for. Commented Nov 5, 2012 at 18:52
  • Do you have a back end? What is your backend language? Commented Nov 5, 2012 at 18:52
  • 2
    JavaScript cannot write to the local filesystem. You can use Ajax to post data to the server and save the values on the server. Commented Nov 5, 2012 at 18:52
  • Since the file is in the server, it should be handled by server side scripts. JavaScript (the client side) should only manipulate data retrieved from the server and then upload it. Commented Nov 5, 2012 at 19:21

4 Answers 4

1

No. You can't. For this you will need backend server software, like PHP.

Sign up to request clarification or add additional context in comments.

Comments

0

You can do it with ActiveX objects - http://www.yaldex.com/wjscript/jsfilecreateTextFile.htm - but you're tying yourself to proprietary IE support.

Other than that, you'll need a server-side language such as PHP.

Comments

0

In HTML5 you can operate on local files via the File API (have a look at http://www.html5rocks.com/en/tutorials/file/dndfiles/ for a quick tutorial) but manipulating files on the server using JavaScript on its own is impossible. You need to use AJAX to send a request to a PHP (or some other server-side language) script to do it for you.

Comments

0

Impossible, only server-side languages

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.