www.webdeveloper.com
Results 1 to 5 of 5

Thread: Need help with a script...

  1. #1
    Join Date
    Dec 2009
    Posts
    3

    Need help with a script...

    Alright, I'm rather old at JavaScript -- I haven't fiddled with it in the longest time. I need someone to help me out with something.
    I know what document.write does, but it doesn't help me with my goal: I want to be able to manipulate specific files on my server.

    Let me clarify this -
    I want to set up a specific directory where I will allow my users to manipulate files. More specifically, I want to allow them to manipulate the text on 1 file (for example, userhome.html). I know one can do this using AJAX, as I have been able to switch the displayed content of one of my pages with an AJAX script.

    err... here is the source code I am using right now:

    Code:
    function ajaxLoader(url,id) {
      if (document.getElementById) {
        var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
      }
      if (x) {
        x.onreadystatechange = function() {
          if (x.readyState == 4 && x.status == 200) {
            el = document.getElementById(id);
            el.innerHTML = x.responseText;
          }
        }
        x.open("GET", url, true);
        x.send(null);
      }
    }
    here is the HTML page:
    Code:
    <html>
    <head>
    <script type="text/javascript" src="ajaxLoader.js"></script>
    <style>@import url("mystyle.css");</style>
    </head>
    <body onload="ajaxLoader('demo.html','contentLYR')">
    This is a test page/script. :)
    <input type="button" value="Demo Page 1" onClick="ajaxLoader('demo.html','contentLYR')">
    <input type="button" value="Demo Page 2" onClick="ajaxLoader('demo2.html','contentLYR')">
    <input type="button" value="Demo Page 3" onClick="ajaxLoader('index.html','contentLYR')">
    <div id="contentLYR">
    </div>
    </body>
    </html>
    I want the users to be able to edit the "demo.html", "demo2.html" and "demo3.html" files.
    The page can be found at http://www.enderia.net/ulrin.com/index/test.html and I appreciate all replies (even those who tell me I'm an idiot -- at least I got noticed and you're keeping this thread alive so somebody with the intellect I require can find it ^^)

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    You'll probably need a Rich Text Editor
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Dec 2009
    Posts
    3
    Quote Originally Posted by Fang View Post
    You'll probably need a Rich Text Editor
    Thanks. This is probably what I need, lol.

  4. #4
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374

  5. #5
    Join Date
    Dec 2009
    Posts
    3
    No, no, it's not like that.
    Basically, I am using a script that will load content from another page without a refresh. What I want to do is implement this, along with a textbox and a button that saves the text inside the textbox to the document they're viewing.

    So, let's say this quote area is the content currently on the file they are editing.
    quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote quote
    and this code area is the textarea they are allowed to edit
    Code:
    code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code code
    I need a button that will save the content inside the textarea (the "code" tag on this bb) to the file being viewed (the "quote" tag on this bb)

    I know how to make a button, I just don't know the correct script for it. The function used to write to a file.

    Code:
    <input type="button" value="Click Me" onClick="[the function I need to know]">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles