Saturday, November 20, 2010

How do I make 2 windows change when the user clicks on 1 link?

I am using the following code (%26lt;a onclick=';window.open(this.href,'download?to make a popup window. However, I want the link to not only make a popup window, but to also change the original page where the link started out. Is there a way to do this?How do I make 2 windows change when the user clicks on 1 link?
%26lt;a href=';file you want to have load in parent window'; onclick=';window.open( 'url for popup window', '', 'options');';%26gt; Link text %26lt;/a%26gt;How do I make 2 windows change when the user clicks on 1 link?
Yes. Usually done by having the one click avtivate a js file on the server, or one downloaded with the page
If your link is:



a href=';somePage.html'; onclick=';window.open(this.href ); return false;'; link text /a



You can change it to:

a href=';somePage.html'; onclick=';window.open(thePopUpFileName);'; link text /a



** Yahoo is removing the carrots



Remove the ';return false;'; and put the pop up link in paranthesis of the window.open() method. That should work.



Additionally you might try an add event script, instead of an inline event handler. That is a more scalable way to doing this.

http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html

No comments:

Post a Comment