Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help simple script

    Hi,

    I need a very simple script that will do the following :

    I have a HTML form.
    I have an input call "title". Say I wrote "fleur-de-lys"
    I have a text area call "text"

    When I hit the submit button I want to do :

    1. Create a HTML webpage with the name in input :
    fleur-de-lys.html
    2. Add the text in "text" somewhere in the body of that new file fleur-de-lys.html
    3. Add a preview of that text somewhere in my index page

    Basically it's like you post a new article on wordpress or whatever, but I just want something simple no database and just need help on how I do this.

    Thank you very much

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,908
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    It is not possible to create an HTML page using Javascript.

    JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Quote Originally Posted by Philip M View Post
    JavaScript [...] has no capability to read from [...] a file
    It has, with the new file api. But the user has to choose the file. Javascript can not access a "random" file.

  • #4
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the replies. Do you have any suggestions how I should proceed?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,125
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Yes. Use a server-side language to do this, where it is quite easy.

    ASP, JSP, PHP, etc. Your choice.

  • #6
    New Coder
    Join Date
    Jul 2011
    Location
    Kediri - Indonesia
    Posts
    61
    Thanks
    2
    Thanked 19 Times in 19 Posts
    ajax supported to do this issue

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,125
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Quote Originally Posted by XterM View Post
    ajax supported to do this issue
    Sure, but you still need to learn and use a server-side language to handle the AJAX call.

    Personally, I doubt that AJAX has any advantage at all in answering this problem. It can be used, but it's overkill.

  • #8
    New Coder
    Join Date
    Jul 2011
    Location
    Kediri - Indonesia
    Posts
    61
    Thanks
    2
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by Old Pedant View Post
    Sure, but you still need to learn and use a server-side language to handle the AJAX call.

    Personally, I doubt that AJAX has any advantage at all in answering this problem. It can be used, but it's overkill.
    that's right. but not too kill if have basic of clientside and serverside programming.


  •  

    Posting Permissions

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