Click to See Complete Forum and Search --> : Opening a New WIndow
royce
09-19-2006, 08:39 AM
I am opeing a new window to show a close-up of a pic using the following code:
<a href="#" onclick="window.open('http://www.website.com/IAN_1004a.jpg', 'resource', 'top=30, left=10, height=500, width=500, resizable=no');")>
<img border="0" src="../bead/necklaces/IAN1004.jpg" width="270" height="347">
My problem is that the original window goes 'back to the top' when the new window opens, causing the user to lose their place on the original window.
Can I make the orignal window stay where it is?
Charles
09-19-2006, 08:48 AM
Yes, and you can keep the link working for those of us who do not use JavaScript as well:<a href="http://www.website.com/IAN_1004a.jpg" onclick="window.open(this.href, 'resource', 'top=30,left=10,height=500,width=500'); return false">
<img alt="[Neclaces]" border="0" src="../bead/necklaces/IAN1004.jpg" width="270" height="347">
</a>Note, if you specify the size then "resizable" defaults to "no". Note also, omit the spacing in the window geemetry. Some browsers are picky about that.
royce
09-19-2006, 11:50 AM
Thanks, Charles! That just worked perfectly.
If I may pose another issue related to this new, open window...
Is it possible to force the newly opened window to remain ON TOP of the original so that, unless the user closes it, it will show subsequent selections?
Right now, when you click on the original window, the new window is hidden.
This can be very frustrating to the user....and me!
Charles
09-19-2006, 03:20 PM
You need something like the following in the document loaded in that window:onblur = function () {this.focus()}
royce
09-19-2006, 05:16 PM
<a href="http://www.website.com/IAN_1003a.jpg" onclick="window.open(this.href, 'resource', 'top=30,left=10,height-=500,width=500');return false"><img border="0" src="../bead/necklaces/IAN1003.jpg" width="288" height="346">
The line of code above is what I have with your suggestions and it works perfectly.
I cannot see where I would put the code to keep the newly opened window ON TOP...
I have tried several positions but I get script error messages.
Could it be because I am bringing up a PIC in the new window and no other docuent, so there is no place to insert the code on the pic.
Charles
09-19-2006, 07:20 PM
It goes in the other document, in http://www.website.com/IAN_1003a.jpg in a SCRIPT block. But images don't have one of those so you'll need to put your image in an HTML document.
royce
09-22-2006, 08:16 AM
I set the pic into a document with the following code:
<body>
<p><img border="0" src="IAN_1003a.jpg" width="360" height="487">
<onblur=function(){this.focus()}>
</p>
<p>Close this window...</p>
</body>
ps: Thanks for all the help here as I am, obviously, not very knowledgeable about all this.
royce
09-25-2006, 02:59 PM
Well, If I were smart enough to actually pose my question in my last post, then I might have gotten a reply!!!! This is why I am ASKING the questions rather than ANSWERING them! :rolleyes:
Okay, the code I posted in the previous post does NOT give me the desired result of keeping the newly opened window ON TOP, so I can only assume that I have either copied it wrong or placed it in the wrong place.
Any help here would be greatly appreciated.