Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The window.history takes focus now
Message
De
07/06/2001 20:18:54
 
 
À
07/06/2001 19:50:14
Information générale
Forum:
Internet
Catégorie:
Javascript
Divers
Thread ID:
00516591
Message ID:
00516715
Vues:
17
>There is something weird in the way those windows work. When I tried var newWin and newWin.focus() at the end, it didn't work. So, I decided to do the history first and then window.open. It didn't work as well. In both situations, the focus is set back to the original window.
>
>If I remove the history, all is ok, however, the original window is blank and I want it to be back to where it was prior to the post.

I made a mistake in the code posted before. Try this one. It works for me.
Notice the use of 'self' as opposed to 'this'. Sorry.
< HTML>
< HEAD>
< META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
< TITLE></TITLE>
< SCRIPT LANGUAGE=javascript>
< !--
 function nw(){
	var newWin = window.open("test2.htm","windowname");
	newWin.opener = self
	self.name = "Main"
	window.history.back()
	newWin.focus()
}
// -->
< /SCRIPT>

< /HEAD>
< BODY>

< P>< input type="button" onclick="nw()" value="NEW WIN"></P>

< /BODY>
< /HTML>
This is what I do to try it:
I access any page in my browser window; then go to this page (via link or entering the URL); then click on the button.
This is what happens: the new window opens with a page that I created (test2.htm), and the main window goes back to the previous page. The focus stays on the new window.

Let me know if it works for you.
Andres M. Chiriboga, MCSE, MCP+I
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform