Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2011, 09:48 PM
Registered User
 
Join Date: Jul 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default newbie needs help please array

Hi,

I have user input from a form that they have selected a month 3 digits.

I have validated to confirm 3 digits and put the value into a var called x

now I created an array called ms with the 12 months in 3 digits.
"jan","feb","mar" etc

how do I search the array to see if the value of x is there?

if it is there I want to say y=1

I have tried:
if (x == ms[]) {y=1;}
I know I am missing something but I am so tired and can no longer think and I feel like an idiot.

Thanks for your help
 
Old November 3rd, 2011, 12:57 AM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try like this.
var length=ms.length
for (i=0;i<length;i++)
{
if (x == msi[]) {y=1;}
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie (very newbie!) question about com.paad.* jkcashin BOOK: Professional Android 2 Application Development 3 June 5th, 2013 06:52 AM
Convering a String Array to an Integer array nkrust C# 9 November 17th, 2010 12:02 PM
multidimensional array help for a newbie grahama PHP Databases 1 May 13th, 2008 09:41 AM
Go from 2d Array to 1d array without defining type OneQuestion General .NET 1 January 10th, 2008 11:13 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.