|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I understand that if you open a window using the window.open() function, giving the window a name 'win', and then open another window using the same window name, it replaces the content of that window.
This was happening fine on my computer, but all of a sudden, it would open another window instead of replacing the contents of the first window, even when the window names were the same. Has anyone come across this problem before? Even better, has anyone found a way of fixing it?!! Thanks, Ben. |
|
#2
|
|||
|
|||
|
It happened to me. Few times.
And the problem was that something in the syntax of opening the window or in the "href" that was sent to the function that held the opening window javascript part,was not ok, so it was ignored. Wanna write the code, so we'll see what's the problem? |
|
#3
|
|||
|
|||
|
Thanks for replying.
The code is irrelevant because it has happened with code that has previously worked and now no longer works. For example, the following code: window.open("http://www.site1.com/", "win"); should open site1.com in a new window. The next line: window.open("http://www.site2.com/", "win"); should then replace it with site2.com - this is now no longer happening. It works in Netscape and works in the same version of IE (5.5) on another computer, so I believe the problem is not with the code, but with the software on my machine. Really frustrating as it is seriously hindering my work!! Regards, Ben. |
|
#4
|
|||
|
|||
|
You're misunderstanding the difference between the variable used to reference a window object in JavaScript and the HTML name of the window. Read this:
http://www.webreference.com/js/tips/000426.html |
|
#5
|
|||
|
|||
|
Adios, there is no misunderstanding here regarding what u mentioned. A variable is needed to do other things like closing windows, etc.But that is not the case here.
Those lines should work. If u replace "win" with "win2" for other links,different windows will be opened. bpp198: I know u said that the code shouldn't be a problem, and so it seems. I would still suggest u to send me the code to test, or upload the file to the web and check if u r still having problem, so we can focus on the problem. Maybe even try to check a site which does the same, and check if it's ok. For exp. u can go to my site: http://library.md.huji.ac.il/ there pick "electronic journals" in the menu,and there pick "journal list" in the sub menu. Press on more than 1 link in the list of journals. They replace the same window. Does it work for you? I am paranoid. I check many things when having a probelm and when I don't know where to start from. So try it. Bad things won't happen. Inform us with your findings. If it's software stuff, I know nothing about it. |
|
#6
|
|||
|
|||
|
Sorry. I forgot. The part I sent u too in my site
is in INTRANET, so u can't access it. Instead, copy the very following code to a new file of yours, and see if it works for u. <html> <head> <title>Untitled</title> </head> <script language="Javascript"> <!-- var IE=false; var NS=false; if (navigator.appName=="Netscape") {NS=true; if (navigator.appVersion.charAt(0)>="5") var NS6=true; } else if(navigator.appName=="Microsoft Internet Explorer") IE=true; var wind=""; var wind2=""; function winOpen(url) //Open new window according to link { if (IE||NS6) { window.open(url,"win"); } else if (NS) { window.open(url,"win"); } } //--> </script> <body> <a href="javascript:winOpen('http://www.yahoo.com/')">link1</a> <a href="javascript:winOpen('http://www.md.huji.ac.il/')">link2</a> </body> </html> Don't forget to inform us... |
|
#7
|
|||
|
|||
|
Thanks all,
Tried the above code, but each link opens in a separate window. I am convinced there is something wrong with my computer now - I will have to try and reinstall IE... not an enviable task though! Strange bug, don't know why it has suddenly started either. Once again, thanks for all the replies. Ben. |
|
#8
|
|||
|
|||
|
Try adding onBlur="window.close()" to the body line of the page that is opening up.
|
|
#9
|
|||
|
|||
|
Thanks, but this is more of a workaround than a solution. I don't want code on the pages that works only for my computer!
I guess I need to find a different forum for this question as it is not really a javascript issue anymore, but is a problem with my computer. Does anyone know anywhere I can go for help? Ben. |
|
#10
|
|||
|
|||
|
http://discussions.virtualdr.com/cg...gi?action=intro
Not a bad place to start with windows probs... |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Internet Explorer window problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|