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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating array from user input

Status
Not open for further replies.

scalawagd

MIS
Apr 3, 2002
1
US
Hi,
I need to populate an array using numerical input from a user. The input is similar to a social security number. Can you help me? I tried to find previous postings dealing with this, but I was unsucessful.
Thanks a lot!
 
Hope this can help.

<BODY>
<FORM NAME=&quot;F1&quot;>
<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;20&quot;>
<input type=&quot;button&quot; value=&quot;Button&quot; name=&quot;B5&quot; onClick=&quot;AddToArray();&quot;>
</form>
</Body>

<SCRIPT language = &quot;JavaScript&quot;>
var myArray = new Array();

function AddToArray()
{
myArray[myArray.length] = document.F1.T1.value;
for(var i = 0; i < myArray.length; i++)
{
alert(myArray);
}
}
</Script>
 
Sorry - last post was JavaScript Version
Here is a VBScript version

<SCRIPT language = &quot;VBScript&quot;>

Dim VBArray()

Dim Cnt
Cnt = 0

sub AddtoVBArray()
ReDim Preserve VBArray(Cnt )
VBArray(Cnt)= document.F1.T1.value
For i = 0 to UBound(VBArray)
msgbox VBArray(i)
next
Cnt = Cnt + 1
end Sub

</Script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top