Re: Displaying typed text
Javascript would be the way, yes, and pretty much the only way I can think of. Basically you need to grab the textbox value and add it to a string, then add it to the innerHTML or childNode.data of the element that is to display the text.
Use += to build the string, and you have to call the function onkeyup event. It'll probably slow the typing down some, and it will break the 'undo' function in IE.
Re: Displaying typed text
Does anyone have an example that I can relate to?
Re: Displaying typed text
Well if you check view source on this page, you'll see a function called postLength() which is one I wrote for a feature we did away with. But it has some of the parameters in common with what this one would need to have.
Re: Displaying typed text
Include this;
Code:
var theTextBox;
var theDisplay;
function doTextKeyUp(e)
{
while (!theDisplay.hasChildNodes())
theDisplay.appendChild(document.createTextNode(''));
theDisplay.firstChild.data = theTextBox.value;
}
addEHandler(window, 'load', function() {
theTextBox = document.getElementById('theTextBox');
theDisplay = document.getElementById('theDisplay');
addEHandler(theTextBox, 'keyup', doTextKeyUp);
});
HTML Code:
<!-- ... -->
<input type="text" id="theTextBox">
<span id="theDisplay"></span>
<!-- ... -->
Re: Displaying typed text
Exactly what I was looking for, thanks!!
Re: Displaying typed text
Now I have another question. With the code that penegate has posted. If I have the info for those text boxes coming in from another page, how would I go about calling the code to execute, and check the text boxes onload. If they are blank we are all set, but if we have info coming over they are automatically prepopulated.
Re: Displaying typed text
If they're already populated when you serve the page just put the same content into the span element.