It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Using Javascript to write text from form to page Problem.

Using Javascript to write text from form to page Problem.

Postby DDragon on Sun Jan 27, 2008 12:29 am

O.K I'm trying to insert the content of a text box onto a web page using javascript i know you use document.write but I'm not sure how to go about doing it. any suggestions?

DD
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby leonard on Tue Jan 29, 2008 12:10 pm

There are several ways to write the text into the HTML-page.
It all depends on where you exactly need to write the text.

use:
Code: Select all
document.myForm.myText.value
to get the content of your text box.

you may use the following functions to write your data to a specific place:
Code: Select all
document.write(myText);
document.getElementById("myID").firstChild.replaceData(rd_Start, rd_Length, myText);
document.getElementById("myID").innerHTML = myText;
document.getElementById("myID").innerText = myText;


cheers!
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland

Postby DDragon on Mon Feb 04, 2008 2:06 am

Thaks for you reply Leonard,

i want to have it so that people can make an addition to comments on a specific page, like a forum set up but not on a forum if that makes sense, will the code that you supplied help in that or will i need something else?

Thanks,

DDragon
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby leonard on Mon Feb 04, 2008 7:44 am

Ah, so if I understand you correctly, you want to store the data persistently. (So that other visitors see it too).

Here's another (unfinished) thread on this topic:
help-with-form-input-vt9046.html

will the code that you supplied help in that or will i need something else
1) The code i supplied will NOT help. The code is only to display information on the screen, not to store it.
2) Yes, you need something else: Code to store the information server-side.
Check the topic above. The last questions also applies to you. Does your webserver support PHP?

cheers!
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland

Postby DDragon on Wed Feb 20, 2008 4:36 am

yes it does support PHP as far as i know unless they have changed it.

DD
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby DDragon on Sat Aug 23, 2008 8:41 am

ok ive just remembered this thread and need to bump it sorry
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia


Who is online

Users browsing this forum: No registered users and 2 guests