...

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



operwolf
02-24-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
02-24-2007, 05:31 PM
Do you mean something like this example?


<script type="text/javascript">

function getInputValue(){

inputValue=document.myform.t1.value

if(inputValue==""){
alert("Please enter some text")
}
else{
alert(inputValue)
}

}

</script>


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum