Javascript Application Help with writing text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NYXX
    New Member
    • Jul 2007
    • 18

    #1

    Javascript Application Help with writing text file

    I wanna know how its possible to clone this website. www.writesomething.net

    I just want the actual programming code and files. I'm going to ceate a fully interactive website for users to input text and it appears directly on to the page without refreshing.


    I can't seem to find the txt file.

    [HTML]<html>
    <head>
    <title>WriteSom ething v2</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="/css/screen_en_US.cs s" rel="stylesheet " type="text/css">
    <script type="text/javascript" src="/js/frontend.js"></script>
    <script type="text/javascript" src="/js/browser.js"></script>
    <script type="text/javascript" src="/js/floating.js"></script>
    </head>
    <body onload="initFlo aters(); document.form1. tekst.focus(); window.scrollBy (0, window.innerHei ght);" onpaste="return false;">
    <a id="top">&nbsp; </a>
    <div id="floater1Div ">
    <div class="home">&n bsp;<a href="/">home</a></div>
    <div class="about">& nbsp;<a href="/about">about</a></div>
    <div class="about">& nbsp;<a href="/press">press</a></div>
    <div class="hrvatski ">&nbsp;<a href="/lang.php?lang=h r_HR">hrvatski</a></div>
    <div class="hrvatski ">&nbsp;<a target="_blank" href="http://www.skarabej.co m/english/">by skarabej</a></div>
    </div><form method="post" action="" name="form1">
    <div class="text">
    </span>
    I wish he'd call... or that I had the balls to call him
    <span class='siva'>
    i'm such a noob.
    </span>
    Test
    <span class='siva'>
    <a id="end">&nbsp; </a><br />
    <textarea name="tekst" onpaste="onPast eHandler()" oncontextmenu=" setContextMenuS election()" oninput="onPast eInputHandler(e vent)" onchange="texta rea_size()" onkeypress="onP asteKeyPressHan dler(event); textarea_size() ;" rows="5" id="tekst" onkeydown="txta rea_clear()" onclick="txtare a_clear()" class="area">wr ite what ever you want, quick and without thinking.</textarea>
    <table width="100%">
    <tr>
    <td align="left" width="33%"><a style="border: none;" href="#top"><im g border="0" src="/images/gototop.jpg" width="50" height="76"></a></td>
    <td align="center" width="33%">&nb sp;</td>
    <td align="right" width="33%"><in put type="image" src="/images/publish.gif" id="submit" name="submit" width="89" height="30"></td>
    </script>
    </body>
    </html>[/HTML]
    Last edited by acoder; Jul 11 '07, 09:42 AM. Reason: Code in tags
  • NYXX
    New Member
    • Jul 2007
    • 18

    #2
    Can anyone help me with this?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by NYXX
      I can't seem to find the txt file.
      What text file are you looking for?

      Comment

      • NYXX
        New Member
        • Jul 2007
        • 18

        #4
        The flatfile database.

        I uploaded this code along with the css and js codes but i still can't seem to publish the text instantly

        Comment

        • NYXX
          New Member
          • Jul 2007
          • 18

          #5
          how would i go about cloning this what am i missing

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            You could use Ajax for this purpose. It takes the input and sends the request to the server-side script which updates the database. The callback function can update the page once it has been added.

            Comment

            • NYXX
              New Member
              • Jul 2007
              • 18

              #7
              Where can I find that information?

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                See the Ajax tutorial links in the Offsite Links thread.

                Comment

                • NYXX
                  New Member
                  • Jul 2007
                  • 18

                  #9
                  So How would i go about clioning this website www.writesometh ing.net

                  I have the exact code he is using.

                  I have these files

                  The Javascript
                  Css
                  images which I will be changing

                  Now I'm missing the html file and the external file where all the text is being written to

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    Have you checked the tutorials? It is not that difficult. You will need a server-side language and preferably a database, though you could use a text file if you want.

                    Which server-side language (e.g. PHP, ASP, JSP, Perl, Coldfusion) do you know?

                    Comment

                    • NYXX
                      New Member
                      • Jul 2007
                      • 18

                      #11
                      I know PHP

                      I'm actually lost I tried following the tutorial. Couldn't get it to work.

                      I would like to use a text file.

                      Comment

                      • NYXX
                        New Member
                        • Jul 2007
                        • 18

                        #12
                        Originally posted by NYXX
                        I know PHP

                        I'm actually lost I tried following the tutorial. Couldn't get it to work.

                        I would like to use a text file.
                        Can anyone help,

                        I'm willing to pay if someone can build a clone

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          Show what code you have or what attempt you have made.

                          I assume you know PHP and can create a text file from the posted input using $_POST. If not, you should check in the PHP forum or start a new thread there for that particular sub-problem.

                          There is more than one possible way to solve this, but this is one way. Use AJAX to make a request to the PHP file with the input from the textarea. This is added to the text file. Now we could return the whole text file all over again, but that could be huge. The alternative is to just update the page by adding to the end of the data, but if someone in the meantime had added something, this would not display. It depends on how accurate you wish to be.

                          One other choice is whether you wish to load the content after the page has loaded or as part of the page load (i.e. a PHP page which just displays the data).

                          If you have a problem with your Ajax script, post it here.

                          Comment

                          • NYXX
                            New Member
                            • Jul 2007
                            • 18

                            #14
                            The problem is I don't know how create an ajax script, or a text file, thats where I'm having trouble.

                            Also I would like to users data to be displayed even on a page load if not shown automatically, I was hoping to se the user above post as well.

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              Originally posted by NYXX
                              The problem is I don't know how create an ajax script, or a text file, thats where I'm having trouble.
                              The text file you would create on the server-side using PHP.

                              Show me your Ajax script. There are plenty of examples in the tutorials. There's also an example in the articles section - see this article.
                              Originally posted by NYXX
                              Also I would like to users data to be displayed even on a page load if not shown automatically, I was hoping to se the user above post as well.
                              Not sure what you mean by this.

                              Comment

                              Working...