Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 14th, 2011, 09:48 PM
Registered User
Points: 29, Level: 1
Points: 29, Level: 1 Points: 29, Level: 1 Points: 29, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old November 3rd, 2011, 12:57 AM
Registered User
Points: 79, Level: 1
Points: 79, Level: 1 Points: 79, Level: 1 Points: 79, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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;}
}
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:59 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.