Howdy!
I want to ask if there is a Possible JavaScript for this: I have a list of Family Names and First Names and in my 1st page I want 'those' people to enter their Family and First Names and after entering, it checks it if is listed on the list I mentioned.
Sorry for the Bad English hope everyone understands//
**ADDITIONAL**
And If the Names are invalid, a pop up beside the text area or something pops up saying that it is invalid or wrong...
THanks in Advance!
0
Help with Javascript Please
Started By Silence, Feb 10 2008 05:17
3 replies to this topic
#1
Posted 10 February 2008 - 05:17
#2
Posted 10 February 2008 - 05:29
Can it be done with Javascript? Sure.
Are you using this for some sort of login/authentication system? If so, you should only do it with Javascript if you have no other way of doing it; and even then, don't rely on it to actually secure anything. Since Javascript is client-side, anyone can view the source code and see what's needed to get in.
But, if this is just a comparison thing or a list-checker, it's fairly simple. Either way, it'd be helpful if you could give more info on what this will be used for :-)
Are you using this for some sort of login/authentication system? If so, you should only do it with Javascript if you have no other way of doing it; and even then, don't rely on it to actually secure anything. Since Javascript is client-side, anyone can view the source code and see what's needed to get in.
But, if this is just a comparison thing or a list-checker, it's fairly simple. Either way, it'd be helpful if you could give more info on what this will be used for :-)
#3
Posted 10 February 2008 - 05:48
Its like a log-in, but doesnt need registration because its already listed on the "list" I mentioned. Get It? And cant we do the Javascript External, or it really needs to be Internal Code. And how about the Pop-Up thingy ever figured out how to do it?
#4
Posted 10 February 2008 - 13:31
You can't 'hide' javascript from the client, you can only do that with server-side stuff.
what you are trying to do is fairly simple, there a few elements you need for this.
1. An array with all the names in, e.g.
Please note, i am by no means an expert in JS, so it might not be the 'best' way of doing it, but from what i can tell, what you are trying to would be better to be done server-side anyway
But either way, hope this helps
what you are trying to do is fairly simple, there a few elements you need for this.
1. An array with all the names in, e.g.
<script type="text/javascript"> var names = new Array(); names[0] = new Array("Harry", "Potter"); names[1] = new Array("Bob", "IsAwesome"); function checkNames(firstname, surname){ for(i=0;i<names.length;i++){ if(firstname == names[i][0] && surname == names[i][1]){ return true; } } return false; } function buttonClick(){ var firstname = document.LogInForm.firstname.value; var surname = document.LogInForm.surname.value; if(checkNames(firstname, surname)){ alert("Logged in"); }else{ alert("not logged in"); } } </script> <form name="LogInForm"> <input type="text" name="firstname"> <input type="text" name="surname"> <input type="button" value="Check Names" onclick="buttonClick();"> </form>
Please note, i am by no means an expert in JS, so it might not be the 'best' way of doing it, but from what i can tell, what you are trying to would be better to be done server-side anyway
But either way, hope this helps
Edited by Bob, 10 February 2008 - 13:33.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users