View Full Version : Assigning values to form text/input boxes

Feb 24th, 2007, 05:27 AM
If I wanted to call a textbox in a form with a function, how could I do so? I can't for the life of me figure out how to assign a variable to one.

I am trying to set up a form with text boxes for the user to input information and click the submit button. Once they do that, an alert box will pop up displaying the information they entered then I the information will be placed in another text box on the web page.

Mr J
Feb 24th, 2007, 05:31 PM
Do you mean something like this example?

<script type="text/javascript">

function getInputValue(){


alert("Please enter some text")



<form name="myform">
<input type="text" name="t1" value="">
<input type="button" value="Get Input Value" onclick="getInputValue()">