Google Answers Logo
View Question
 
Q: JS - Why doesn't this script work? ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: JS - Why doesn't this script work?
Category: Computers > Programming
Asked by: cclegg06-ga
List Price: $5.00
Posted: 07 Aug 2003 12:06 PDT
Expires: 06 Sep 2003 12:06 PDT
Question ID: 241082
Can someone tell me why this doesn't work?  I'm trying to pop a page
if someone exits a page and a checkbox is left unchecked.

// Start onUnload script//
function noBuy(){
 if (agree.checked == false )
   {
   newwindow=window.open('http://www.mysite.com','name','height=500,width=500,scrollbars=yes');
   if (window.focus) {newwindow.focus()
   return false;   
   }
 else
   return true;}
// End -->

Request for Question Clarification by secret901-ga on 07 Aug 2003 15:37 PDT
Hi cclegg06,
It appears that you forgot a closing curly bracket (}) after
newwindow.focus().  However, your true problem may lie in the way you
refer to the checkbox. Please let us know the context of your code
(i.e. where in the page is the function located, where the checkbox
agree is at, etc.) so that we can further assist you in eliminating
this problem.  If you can, please post the relevant part of the source
of your page.

secret901-ga

Clarification of Question by cclegg06-ga on 08 Aug 2003 05:52 PDT
That fixed it. It was both the bracket and my reference.  Thanks

Request for Question Clarification by secret901-ga on 08 Aug 2003 09:31 PDT
I'm glad that fixed your question.  May I answer your question officially?

secret901-ga

Clarification of Question by cclegg06-ga on 08 Aug 2003 10:23 PDT
Please do.
Answer  
Subject: Re: JS - Why doesn't this script work?
Answered By: secret901-ga on 08 Aug 2003 11:52 PDT
Rated:5 out of 5 stars
 
Hello cclegg06,
I'm glad that my suggestion solved your problem.  Below is my original
suggestion.

It appears that you forgot a closing curly bracket (}) after
newwindow.focus().  However, your true problem may lie in the way you
refer to the checkbox.

I hope that it was helpful.  If you still encounter problems in your
script, please request for a clarification and I will be glad to
assist you further.

Good luck,
secret901-ga

Search strategy:
javascript reference
cclegg06-ga rated this answer:5 out of 5 stars

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy