Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grab text from a file

Status
Not open for further replies.

schmoose

Technical User
Apr 6, 2008
3
GB
Hi I have a webform and it has three radio buttons. The buttons are labelled 1, 2 and 3. Only one can be selected at once. In the same folder as I keep the htm file I have three text files they are named 1.txt, 2.txt and 3.txt, the contents of these change from time to time. What i would like to do is be able to click on a radio button and then have the contents of the corresponding text file fill in a textarea box.
Any help much appreciated.
Thanks
Rob
 
I am thinking this is not actually possible BUT-
I arent using this on the internet I am using it on my own PC, so I dont mind putting the text in .js files instead - Is it then possible to reference the text in these and do as i mention in my first post?
Thanks,
 
Consider using iframe rather than textarea.

_________________
Bob Rashkin
 
Is this to be edittable or not? If so, you could use server-side scripting (if that's available) to load the text from the different files into Javascript variables, or just put the text into Javascript variables then display the appropriate variable's content in the textarea when the radio button is selected.

If you don't need this to be editted, then you can use a <div> and change the content the same way, or use an <iframe> as previously suggested.

Lee
 
Hi guys ive solved it thanks for your help, I used the .js file and wrote the .value explicitly into the field.

thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top