Opening pages in the same / child window concern 
Author Message
 Opening pages in the same / child window concern

Hi,

 And yet another question:

 What is the best way to control whether a <a href...> link opens in the
same
or in a child window?

 What I've done so far is just adding an onClick even to each link which
calls the function below:

 function link() {
  var data = event.srcElement.href;
  event.returnValue = false;
  page = window.open(data)

Quote:
}

 Now, is there any way to achieve the same without putting an onClick event
on each link, and thus save space?

 Thanks
Benjamin



Sat, 03 Aug 2002 03:00:00 GMT  
 Opening pages in the same / child window concern
Hi

If i got you right:

var MyWin = 0;
function oWin(theURL){
if( MyWin == 0 || MyWin.closed ) MyWin = window.open(theURL,....);
  else MyWin.location.href = theURL;

Quote:
}

<a href="JavaScript:oWin('pageToGo.htm')">Link</a>

--
Best Regards
 Vidar Petursson MVP
http://www.icysoft.com


No matter where you go there you are
-

Quote:
> Hi,

>  And yet another question:

>  What is the best way to control whether a <a href...> link opens in the
> same
> or in a child window?

>  What I've done so far is just adding an onClick even to each link which
> calls the function below:

>  function link() {
>   var data = event.srcElement.href;
>   event.returnValue = false;
>   page = window.open(data)
> }

>  Now, is there any way to achieve the same without putting an onClick
event
> on each link, and thus save space?

>  Thanks
> Benjamin



Sat, 03 Aug 2002 03:00:00 GMT  
 Opening pages in the same / child window concern
Thanks, Vidar!

Not actually what I meant --
which originally was getting rid of the JavaScript:oWin('pageToGo.htm')
part.
The links should look normal, but be "processed" by an event handler that
decides whether to open it in the same or in a child window.

BTW, would you please take a look at my reply to Passing parameters part 2?

Thanks so much,
Benjamin



Sat, 03 Aug 2002 03:00:00 GMT  
 Opening pages in the same / child window concern

I posted an answer in dhtml NG.

Eric K.

  Thanks, Vidar!

  Not actually what I meant --
  which originally was getting rid of the JavaScript:oWin('pageToGo.htm')
  part.
  The links should look normal, but be "processed" by an event handler that
  decides whether to open it in the same or in a child window.

  BTW, would you please take a look at my reply to Passing parameters part 2?

  Thanks so much,
  Benjamin



Sun, 04 Aug 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Opening pages in the same / child window concern

2. Detecting a child window opening

3. Testing if child window is open

4. Using Window.Open to open HTML page

5. Refresh parent window from child window

6. Child window refreshing parent window

7. Child Window can't talk to parent window -- or vice versa

8. help, I can't create an array from child window in parent window

9. Refreshing parent window from child window

10. window position of child window

11. Help with child window refreshing calling window

12. Updating parent window and closing child window

 

 
Powered by phpBB® Forum Software