Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a form to show what you type 1

Status
Not open for further replies.

hitsuin

Vendor
Aug 23, 2010
24
GB
Hi everyone, I've looked online but can't figure out how to get a page to print out a whatever text I write in a box on the same page below the textbox. I can't use response.write as the avascript will be expanded to manipulate the input.

If you have any idea's please let me know.
Many thanks.

Code:
<html>
<head>
<script type="text/javascript">
function show_prompt()
{
document.write(textbox);
}

</script>
</head>
<body>

<form action="">
Textbox </br> <input type="text" name="textbox" /><br />
</form>

</body>
</html>
 
Thanks for trying, it probably would have helped me if I wasn't an ameteur who slams code together and tries to get them to work. I'm looking into this div stuff but don't see how to marry the two yet.
 
Something like this:

Code:
<html>
<head>
    <script type="text/javascript">

        function copy_text() {
            var theText = document.getElementById('textbox').value;
            var theDiv = document.getElementById('targetDiv');
            theDiv.innerHTML = theText;
        }

    </script>
</head>

<body>
    <form action="">
        Textbox
        </br>
        <input type="text" name="textbox" id="textbox" />
        </br>
        <input type="button" value="Copy text" onclick="copy_text();" />
    </form>
    
    <div id="targetDiv"></div>
</body>
</html>

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Thank you very much Dan, this has given me the insight to the missing link I sorely needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top