...

View Full Version : Easy Content Updating



DR.Wong
02-01-2005, 05:25 PM
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 :thumbsup:

Can fix your Chopstick!
*DR.Wong :p

Brandoe85
02-01-2005, 05:27 PM
Javascript is done on the client-side, you'll need a server-side language such as php, asp, perl....to read the txt file.

Willy Duitt
02-01-2005, 05:42 PM
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

DR.Wong
02-01-2005, 05:43 PM
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! :thumbsup:

Can Fix Your Chopstick! :p
*DR.Wong

Willy Duitt
02-01-2005, 05:51 PM
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! :thumbsup:

Can Fix Your Chopstick! :p
*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

DR.Wong
02-01-2005, 05:56 PM
Calm down! :eek:
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

dlg0351
02-01-2005, 07:04 PM
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! :)

DR.Wong
02-01-2005, 07:09 PM
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. :thumbsup:

You are da Man!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum