Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: DHTML
Expertise: Beginner
Oct 28, 1998

Dynamically Change Another Opened Window

Question:
I am having trouble creating a site where customers can click something in a parent window and have a picture appear in another child window. I then want customers to be able to click something else in the parent window and have another picture show up in the same child window as before (the customer can keep clicking). I want to use DHTML for the sake of simplicity and also because I do not want the child window to have to refresh itself every time the customer clicks something new. What would be a simple solution to this problem? I have read up on the "window" object (the top of the object hierarchy) but it seems that in DHTML, an event can only affect a tag in the same windows that the event is in. I would appreciate any advice you can give.

Answer:
This problem is actually pretty simple to solve, although you need to understand a little bit about the document object model. Whenever you create a window (or a frame, which is essentially an embedded window) you are actually creating a programmatic object that happens, not coincidentally, to control the contents of what's displayed on the screen. The object that's exposed in DHTML is a window object, and it forms the very top of the hierarchy in Dynamic HTML.

The following JavaScript code can be used to open up a new window:



	     

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date