JavaScript Load New Page Question - Stack Overflow

What I am looking to do is if a user plete a form it will provide access to a new location.<script l

What I am looking to do is if a user plete 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');

What I am looking to do is if a user plete 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.');
Share Improve this question asked Apr 18, 2010 at 6:02 MichaelMichael 3314 gold badges6 silver badges17 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 3
if (validateForm(theForm)) window.location = 'http://www.google.';

Is equivalent to using

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

Both will work, so choose which one you prefer.

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

bees

if ((lastname == "") && (firstname == "") && (email == "")) {
    window.location = "http://www.google.";
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742360901a4429372.html

相关推荐

  • JavaScript Load New Page Question - Stack Overflow

    What I am looking to do is if a user plete a form it will provide access to a new location.<script l

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信