I am know to Javascript so this is probably a basic question. How do I store user information from a field to an array and call it using a button to print it out later?
@wb31authorApr 02.2009 — #Ok, I am looking to use a text field where the user can enter their name. The kind of information is a string. When the add button is activated an alert box shows their name.
Here is my code
<html>
<head>
<script>
function submitForm()
{
var myForm = document.registrationForm;
var user_name = name; var name = document.getElementById("enterName");
var myUserName;
var name = ""; var userarray;
if (myUserName == "") { var userarray = new Array(); var myUserName = myForm.user_name.value; myName = "<p style=color:red>Please enter your First name.</p>"; myUserName = name; name.innerHTML = myName; //alert(myUserName); return false; } else { var userarray = new Array(1); userarray[0] = ""; var myUserName = myForm.user_name.value; myUserName = userarray; alert(userarray[0] = ""); } }