1

i am making some script for some personal use. Now i tend to keep my CD collection list in a html file which has some sleek design, but i am tired of editing the list by "hand" and that means that i don't want to edit the code everytime i add new CD. So is there a way that i can use JS or JQuery so i could add/read from a local file(this script is not remote it is local(although i might try to host it remote).

I don't want to use any other language than HTML, CSS and JS/JQuery.

EDIT: Is it possible to add a link that when i click some application on my computer would launch.

1
  • If what you're asking for is access to the file system with clientside (in browser) javascript, you're most likely out of luck: stackoverflow.com/questions/1087246/… Commented Aug 16, 2010 at 17:51

2 Answers 2

1

Not if you only want to use HTML and javascript. You will need a server side script of some kind to write to a file.

The comments got me thinking, I know this is not really what you were asking but you could play around with server side javascript with node.js

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

4 Comments

While not yet fully supported, this should be possible using HTML5's local storage.
but the script will be on my computer so my pc will be server and client in same time. I think it should be possible somehow.. :D
Why? JavaScript is sandboxed so it can't touch the local machine (except through certain very limited channels). A web server running locally is just another web server accessed over the network (even if it is the loopback interface) as far as JS is concerned.
Even though the script is on your computer, its executed by an engine running in browser.
0

You can do it like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>CD Collection</title>
    <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        var cds = ['cd1', 'cd2', 'cd3'];
        $(function() {
            $(cds).each(function() {
                $('#cd_list').append('<li>' + this + '</li>')
            });
        });
    </script>
</head>
<body>
    <p>
        <ul id="cd_list"></ul>
    </p>
</body>
</html>

The inline js with the cd list can be loaded in as a separate file in the same way jquery was pulled in.

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.