Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do i 'if-not' a large ammount of strings/values?

    how do i say if-not for a alot of strings? can i put these strings in an array and if!=<arrayname>?

    i need help, please help.

    EDIT: I need to validate a string of text. It has to be one of the one(s) stated (they will be loads of these)

    the else function is not any use since there is to many...
    Last edited by vkidv; 04-11-2003 at 07:18 PM.
    Regards
    VKiDV

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your question is pretty vague, but the logic goes like this:

    Code:
    if (this == that) // If they are equal
    
    if (this != that) // If they are not equal
    I hope this is what you're looking for.

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, but thats not what i need. thanks for trying.

    i need somthing which
    if (somthing!=tosomthing)

    can 'right' ones be put into an array?
    tosomthing= new array(10)
    tosomthing[0]="Helllo"
    tosomthing[1]="ByeBye"
    tosomthing[2]="What"

    and if somthing is not equal to 'tosomthing itcalls the next thing up?
    is this possible?
    Regards
    VKiDV

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes. Elaborate on the data you have, cuz all these 'somethings' are making me dizzy
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Perhaps the following sample page will show you how to do this easily:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    	<head>
    		<title>Testing</title>
    		<script language="javascript" type="text/javascript">
    			var tosomthing = new Array(10);
    			tosomthing[0]="Helllo";
    			tosomthing[1]="ByeBye";
    			tosomthing[2]="What";
    			function inarray(ar,it)
    				{
    				return (ar.join(' ').indexOf(it) < 0) ? false : true;
    				}
    		</script>
    	</head>
    	<body>
    		<script language="javascript" type="text/javascript">
    			document.write(inarray(tosomthing,'ByseBye'));
    			document.write('<br />');
    			document.write(inarray(tosomthing,'ByeBye'));
    
    		</script>
    	</body>
    </html>

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If that's the case, some posts were just made about that (roughly)
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •