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
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    Smile Easy Content Updating

    I have a news page on my website and I want to know if it is possible to Shove some text into a '.txt' file and then make javascript read the text file and display its content as text (not in a text area) on my page.
    This would save a whole lot of time updating my web pages content.
    Also, as an extra, (not a must have) If loadin the text file fails, it comes up with a default message like 'sorry, no current news. Please try Again later'

    But getting the text onto the page is my main concern.

    If this is posible, please show me How

    Can fix your Chopstick!
    *DR.Wong

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Javascript is done on the client-side, you'll need a server-side language such as php, asp, perl....to read the txt file.

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Although I do not like using iframes and try to avoid them...
    The simplist solution would be for you to display the text file in an iframe... Particularly since any javascript solution would make your page inaccessible for those with javascript disabled...

    .....Willy

  • #4
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    Smile Okay, well I guess that wont work.

    I see...

    Well It would still be interesting to see if it can be done. I have some other FUN uses for it aswell, so if you can do it, then Please Bring it on!

    Can Fix Your Chopstick!
    *DR.Wong

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DR.Wong
    I see...

    Well It would still be interesting to see if it can be done. I have some other FUN uses for it aswell, so if you can do it, then Please Bring it on!

    Can Fix Your Chopstick!
    *DR.Wong
    Do what?? I just told you what methods to use...
    If you expect me to create an external text file and another document to demonstrate using an iframe... forget about it, that is something for you to do and post back showing us YOUR attempt and we will try to answer any additional questions you may have...

    .....Willy

  • #6
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    Exclamation Whooaa!

    Calm down!
    I posted my reply while you were posting yours!
    I was not replying to you, I am trying your method but the thing is that it cannot open into the middle of the page properly and it does not go with my sites theme. That is why I staed that It should be text not in a text area format.

    I am here asking for help!

    Can Fix Your Chopstick!
    *DR.Wong

  • #7
    Regular Coder
    Join Date
    Jan 2005
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What you could do is use an external .js file and make a call to a function to post you news information.

    I am doing something similar on a website for an employee directory, that calls a function to display the employee's contact information onClick. You could do the same thing onLoad of the page and use document.write to display the the news info.

    Good luck!

  • #8
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    Thumbs up

    Thank you very much. I actually have a similar password system that calls on javafiles and uses the information from within them.

    I did not think of that.

    You are da Man!
    -DR.Wong

    Wheres the food at?


  •  

    Posting Permissions

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