Log in

View Full Version : Only a little thing, I'm sure ...



MattyBumBum
07-31-2006, 10:19 AM
Hello helpful faceless folk,

All I want is this: when someone clicks a link to a picture on my main page, a new window opens to display the picture. Easy peasy. But then if they don't close the window and they click on another link on my main page, I want the new picture to be displayed in the same already open window, rather than another new one opening.

Can someone help me here? I'm sure it can't be much.

Cheers,
Matt

BLiZZaRD
07-31-2006, 10:27 AM
Easy enough. Give your pop up links a name variable:



window.open('mywin.htm','name','height=255,width=250, toolbar=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no');


When you make the links... just make sure NAME is the same. That's it.

Or if you are using JS to make the pop up:



TheNewWin = window.open('','name','height=255,width=250, line toolbar=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no');


Same thing there though, just different pop up controls :)

djr33
07-31-2006, 10:41 AM
popups might be blocked.

<a href=... target="_blank">
will give you a new window.

The catch is that it needs a name attached to it, and I'm not sure how to do that. there are certainly complex ways in javascript.

The above will work, but requires using a javascript popup script, and that doesn't seem like the best solution, though it would work, and most likely be ok with most popup blocker as it is user-initiated, not automaticaly loaded.

BLiZZaRD
07-31-2006, 10:48 AM
Of course the way around that is to put a "disclaimer" text on that page telling visitors they need popups/JS enabled to view the content they are after.

I have my pop up blocker on strict, and I have it turned off about the warning, so I never even know about the pop ups.. it's nice to see those little disclaimers so I can go and add the site to the white list.



<edit> Yes I know that wont work all the time either, but then at least you can say "I told you so!" </edit>

djr33
07-31-2006, 10:55 AM
Really, in the end, just don't worry about it. It's not complex to close a window if you have too many.
If there is a specific reason you need this, then look into complex javascript and/or javascript popups, but it will be easier for you (and your viewers) if you DON'T put anything rather than putting something incredibly complex and likely fairly incompatible. (Most javascript isn't the same in all browsers/systems)

MattyBumBum
07-31-2006, 12:03 PM
Thanks chaps, I'll go the simple BLiZZaRD way if only I can get rid of the automatic border in the pop-up window ????


I tried simply sticking leftMargin=0 topMargin=0 marginwidth="0" marginheight="0" in the brackets, but to no avail yet.

BLiZZaRD
07-31-2006, 01:38 PM
try "border=none" or "border=0"

Not sure though... I need a nap :)

mburt
07-31-2006, 04:04 PM
Instead of having to make a page for each pic, just make the link the img src:



<a href="whatever.jpg" target="_blank">