Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a 'Not Defined' Error when trying to focus a window

Status
Not open for further replies.

TechnicalLoser

Technical User
Nov 19, 2001
26
CA
I have a catalog and when a person clicks on the buy button it brings up the shopping cart window in a new window. I use an onload function to name the cart window. "checkout"
onload namer( ) ....
function namer( ){window.name="checkout"}

I have a link for people to blur the cart window so they are back at the catalog. All this works great and I have tested to make sure that the cart window is named "checkout". I have an image link in the catalog that when clicked should make the cart window have the focus. Function below:
function cartfoc( ) {checkout.focus( )}
But nothing happens and when I check type in javascript: to see the error it says somethinig along the lines of Javascript Error....
checkout is not defined.

Could somebody please help. I thank you in advance for your help.
 
you say...

"...in a new window. I use an onload function to name the cart window..."

try creating a variable, then give it the open window object...

ex.

checkout = window.open('page here','name window','window properties')...etc.

this way, you should be reference the window from both the parent and the child itself...

- spewn
 
I never thought to pre-open the cart window first. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top