Storing data into a variable

[Total: 0    Average: 0/5]

This example shows how to store data from a form textbox into a variable.

Body Code:

<form name=exf1>
<input type=text name=myname value="Mike">
var _myname="<NOT DEFINED>";
function whatIsName() {
  alert("The variable _myname="+_myname);
function storeName() {
  _myname = document.exf1.myname.value;
<a href="javascript:storeName()">Store the name in the form text box into the variable _myname</a>
<a href="javascript:whatIsName()">Click here to see the value of the variable _myname</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *