View Full Version : input type=text
01-16-2004, 06:59 PM
Hi wpw members,
I am the sort of guy who likes to have the ability to have a load of features on my site to give the impression that I know what I am doing (potential clients please take no notice!)
I would like to know how I can have an input box on my webpage that will display the inputted text elsewhere on the screen. It seems like one of the most simple tasks that most people probably learn before they can even alter a font colour, but please help me because I really can't manage this...
01-16-2004, 07:30 PM
From Internet Explorer 4.0 and on it provides a set of properties and methods on each element that are designed to make it quite simple to change the document. There are four properties that provide the ability to see what's inside an element on the page and replace that content with new information: innerText, outerText, innerHTML, and outerHTML.
There is a good tutorial and sample code that will explain in greater detail here at the MSDN library (http://msdn.microsoft.com/workshop/author/dyncontent/content.asp?frame=true#dc_adding)
I am not sure how to do it in Netscape, but there should be something similar to it.
01-20-2004, 05:10 PM
You can change the displayed text using PHP (or ASP), but you will have to call the page again.
You cannot change the displayed text using HTML alone.
Font Colours come a long way before this... (:->
01-20-2004, 07:45 PM
The two replies above are pretty much "on the money". I'm not sure exactly what effect you had in mind with the text being entered into an input box. One way to achieve a similar effect would be to have two virtually identical pages, and use a cookie to store the data inputted from the first page, then read the info from the cookie and write it out on a second page. Joe Burns of HTML Goodies fame has a good walkthrough on passing variables (http://www.htmlgoodies.com/beyond/jspass.html) which may be worth a look.
Hope that helps,
01-21-2004, 06:30 AM
One way to achieve a similar effect would be to have two virtually identical pages, and use a cookie to store the data inputted from the first page, then read the info from the cookie and write it out on a second page.
You could also call the same page, and the data would appear on the second viewing of the page.
01-21-2004, 07:14 AM
I have a little more of an idea about this now. Please don't put too much effort into answering this question though because I probably won't be using this technique for anything important.