Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  15] [ 1]  / answers: 1 / hits: 15408  / 14 Years ago, sun, april 18, 2010, 12:00:00

What I am looking to do is if a user complete a form it will provide access to a new location.



<script language=JavaScript type=text/javascript>     
<!--
function validateForm(theForm) {
var firstname = theForm.firstname.value;
var lastname = theForm.lastname.value;
var email = theForm.email.value;
if (firstname == ) {
alert(Please fill in your First Name.);
theForm.firstname.focus();
return false;
}
if (lastname == ) {
alert(Please fill in your Last Name.);
theForm.lastname.focus();
return false;
}

if (email == ) {
alert(Please fill in your email address.);
theForm.email.focus();
return false;
}
return true;
}


I know this part is wrong but I have no idea how to go about doing it. any help would be nice..



 if lastname=
if firstname=
if email=
load('www.google.com');

More From » javascript

 Answers
101
if (validateForm(theForm)) window.location = 'http://www.google.com';


Is equivalent to using



if (validateForm(theForm)) window.location.href = 'http://www.google.com';


Both will work, so choose which one you prefer.


[#97046] Wednesday, April 14, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaden

Total Points: 709
Total Questions: 91
Total Answers: 91

Location: Maldives
Member since Sat, Jan 29, 2022
2 Years ago
jaden questions
Tue, Jun 29, 21, 00:00, 3 Years ago
Sun, Jul 5, 20, 00:00, 4 Years ago
Fri, May 29, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
;