Click to See Complete Forum and Search --> : Java Script Help


Redhead
05-14-2004, 09:51 AM
Hi There

I have a page with a text box, i want the user to be able to enter a number i give them that takes them to another page..

I need alot of help were can i go to find that type of script..

I have this type of script and not sure how to edit it to make it do what i want


function validForm(passForm) {
if (passForm.passwd1.value == "111111"){
I want to open the new page
else
alert("please try again")}


PLEASE HELP ME! :confused:

neil9999
05-14-2004, 10:07 AM
Try this:

<input type="text" id="password">
<input type="button" onclick="if(document.getElementById('password').value=='42323'){window.location='http://www.google.co.uk'}">

Bear in mind this is not secure, as viewing the source code gives the game away. If you want it secure, use a server side language, like PHP.

Neil

Redhead
05-14-2004, 10:20 AM
Ok, if i want it to be secure how would you do that in PHP

neil9999
05-14-2004, 10:25 AM
Sorry, I don't know PHP. Try posting in that forum.

Neil

Redhead
05-14-2004, 10:29 AM
Ok that's great, Just wanted to post a note to say thank you for all your help. It was much easer than i thought it would be. You have been great help, the best part i understand it all. :)

Redhead
05-14-2004, 10:35 AM
I have a very very silly question, is there anything we could ad to a page to hide all java scripts like that?

neil9999
05-14-2004, 10:46 AM
Judging by the second-top thread on this forum:

http://www.webdeveloper.com/forum/showthread.php?s=&threadid=26841

I'd say no.

Neil