Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-16-2004, 07:59 PM
WebProWorld Pro
 

Join Date: Jan 2004
Location: Milton Keynes, UK
Posts: 117
DarrenPWS RepRank 0
Default input type=text

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...

Many Thanks,

Darren Darkins.
Reply With Quote
  #2 (permalink)  
Old 01-16-2004, 08:30 PM
ronniethedodger's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Central US
Posts: 1,581
ronniethedodger RepRank 0
Default

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

I am not sure how to do it in Netscape, but there should be something similar to it.
Reply With Quote
  #3 (permalink)  
Old 01-20-2004, 06:10 PM
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Spain
Posts: 343
computergenius RepRank 1
Default Page refresh needed

You can change the displayed text using Javascript, without refreshing the page. However, not everyone has Javascript enabled.

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... (:->
__________________
Pete Clark
Advertise events locally in Spain for free - http://hotcosta.com/events.php
Reply With Quote
  #4 (permalink)  
Old 01-20-2004, 08:45 PM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

Hi Darren,

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 which may be worth a look.

If you're interested in the idea of Javascript manipulating the innerHTML that Ron mentioned... I have a demo that I was messing about with... it's rather cobbled together.. but it may give you some ideas.

Hope that helps,

Paul
Reply With Quote
  #5 (permalink)  
Old 01-21-2004, 07:30 AM
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Spain
Posts: 343
computergenius RepRank 1
Default

Quote:
Originally Posted by paulhiles
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.
__________________
Pete Clark
Advertise events locally in Spain for free - http://hotcosta.com/events.php
Reply With Quote
  #6 (permalink)  
Old 01-21-2004, 08:14 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: Milton Keynes, UK
Posts: 117
DarrenPWS RepRank 0
Default Thanks

Thanks everyone,
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.

Thanks
DD
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0