![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2004
Posts: 26
Rep Power: 0
![]() |
Must be 18 to register
I need to make a script using javascript that makes an alert saying " You must be 18 to register" if the birthday that entered shows that they are under 18. This may seem easy for other people but Javascript isn't my best subject. If someone can point me in the right direction, it would be greatly appreciated.
|
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
I don't do any JavaScript (at all) but I can point you to w3schools.com for all your JavaScript (and other Web Development) learning needs.
There was probably a similar thing when you registered for this very forum. Go to some message boards and go through the registration process, then do view source when you are at the point where it asks you your age. This will shed some light on how the professionals do it. |
|
|
|
|
|
#3 |
|
Expert Programmer
|
Thanks for the link man, actually it iwill be useful for even me
![]()
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
Theres no good way to do it in JS, JS requires their system time to be correct, use a server side language like PHP or ASP my friend...
__________________
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
He's right ya know. I suggest doing both actually - the JavaScript will stop them from making a mistake (if it is a mistake), and the PHP will stop anyone (with the wrong system time or disabled JavaScript) from getting through.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
Indeed. They are right. that's how i'd to it.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Dec 2004
Posts: 26
Rep Power: 0
![]() |
If I could do with it PHP i would do it in an instance but i'm doing it for someone who doesn't have access to there server. It's one of those sites that gives out freeforums. That's why i'm required to do it in Javascript.
|
|
|
|
|
|
#8 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Fair enough. If people want to get in, they'll just change their DOB anyway.
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() |
Do it this way, have a remotely linked JS file set variables for system time from your home server and then write the JS code for 18 auth....
HTML: <script src="http://my.website.wherever.com/scripts/currentTime.js"> currentTime.js: <?php
echo "var month = " . date("m") . ";\n"
echo "var day = " . date("d") . ";\n"
echo "var year = " . date("y") . ";\n"
?>
__________________
|
|
|
|
|
|
#10 |
|
Newbie
Join Date: Dec 2004
Posts: 26
Rep Power: 0
![]() |
Thank you tempest = D
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|