Anyone can please help in this. I need to assign a path for a text file in a variable to be shown later on in html here's my code:




<!-- Header -->
<!-- End Header -->

<!-- Main -->
<section id="main">

     <script type="text/javascript">

        var reader = new FileReader();

        function readText(that){

            if(that.files && that.files[0]){
                var reader = new FileReader();
                reader.onload = function (e) {  
                    var output='myFile.txt'; // Here's the variable I want to assign my path in         

                document.getElementById('text').innerHTML= output;
                };//end onload()

        <!-- Cols -->
        <div class="cols">
            <h2>Contact Us</h2>
            <!-- Col -->

                  <div id="text"></div>

            <!-- End Col -->

        <!-- End Cols -->

<!-- End Main -->


Recommended Answers

All 7 Replies

Is the text file local or retrieved on the net?

are you asking for storing the file to a new path or its original path?

i am getiing little bit confusion on your question

pls clarify me so that i will help you soon

Have you fixed it?

sorry for being late.
I want to save a text file path in the js variable so i can retrieve it later inside my html.
I want to retrieve the text inside a file that is uploaded on my server also but so when someone needs to edit the text to go inside the file edit and save it and the changes he did to be applied in the website.
Any help?

If your question is resolved, please set the post as Solved and also mark the answers that was helpfull to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.