Google Answers Logo
View Question
 
Q: HTML/JavaScript: getting form entries to display further down a webpage as text ( No Answer,   1 Comment )
Question  
Subject: HTML/JavaScript: getting form entries to display further down a webpage as text
Category: Computers > Internet
Asked by: fieldlily-ga
List Price: $12.00
Posted: 02 Oct 2006 13:03 PDT
Expires: 01 Nov 2006 12:03 PST
Question ID: 770227
I have three related questions on Google Answers right now. I think
these issues are likely to be trivial for anyone with a solid working
knowledge of web programming; I am pretty much a neophyte.

Sometimes I want students (I am a teacher; my site users are all my
students) to be able to enter some text into a text field and then see
it display further down the page. I use a basic form along with this
code:

<input type="button" value="Submit"
onClick="document.all.position2.innerHTML = document.all.position.value">

where "position" is the name of the text field, and a tag further down
in the document says <font id="position2".

But if I want the same text to show up multiple times in the document,
it looks like this:

<input type="button" value="Submit"
onClick="document.all.position2.innerHTML =
document.all.position.value, document.all.position3.innerHTML =
document.all.position.value, document.all.position4.innerHTML =
document.all.position.value,
document.all.position5.innerHTML = document.all.position.value,
document.all.position6.innerHTML = document.all.position.value ">

Then I've been using a different font id tag every time I want the
text to display. There must be a better, simpler way. How can I clean
this up so that I can use the same tag every time I want this text to
be displayed later in the document? Is it possible?

Informed comments welcome!
Answer  
There is no answer at this time.

Comments  
Subject: Re: HTML/JavaScript: getting form entries to display further down a webpage as t
From: crythias-ga on 08 Oct 2006 15:55 PDT
 
Why not put your code in a <script> tag anyway... you can simply call
the function in the onchange or onblur method and let the script
handle the semantics.

I think there is a way to do a loop through appropriate types of content.
This: http://pietschsoft.com/Blog/Post.aspx?PostID=1303
lists through all elements.
It would be reasonable to use a case or if construct to determine if
you need to update...
http://jennifermadden.com/javascript/loopForms.html tells you how to
check through elements.

But... you should be able to do document.FormName.Fieldname.value=value
http://bton.com/tb16/jsref/array.html another suggestion.

PS... if you're using FireFox and would like some "help" on clicking
these urls, I understand URL Link
https://addons.mozilla.org/firefox/403/ is a good option.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy