Opening a image in a new window

R

Ria Van Heerden

Hi

I have small thumbnail pics on my site - I want the client to click on them
and then a new window will open without the toolbar and menu and the other
stuff - displaying just the enlarged image. Can somebody help me to do this
I just cant seem to get it right

Kind Regards
Ria
 
S

SpaceGirl

Ria Van Heerden said:
Hi

I have small thumbnail pics on my site - I want the client to click on them
and then a new window will open without the toolbar and menu and the other
stuff - displaying just the enlarged image. Can somebody help me to do this
I just cant seem to get it right

Kind Regards
Ria


You should be warned before going down this route, a *lot* of browsers block
popups like this... A good percentage of people visiting the site, upon
clicking the link will see nothing. Popup windows without toolbars requires
scripting;

<script language="javascript" type="text/javascript">
function popUp(popupURL){
var myPopup =
window.open(popupURL,"photo",'toolbar=0,location=0,directories=0,status=0,me
nubar=0,resizable=yes,scrollbars=yes,width=550, height=550');
photo.focus();
}
</script>

<a href="thepicture.jpg" target="photo"
onclick="popUp("thepicture.jpg")"><img src="thumb.jpg" alt="picture" /></a>


watch out for the word wrapping in all of that.
 
S

SpaceGirl

<a href="thepicture.jpg" target="photo"
onclick="popUp("thepicture.jpg")"><img src="thumb.jpg" alt="picture"
/></a>

oops, should be:

<a href="thepicture.jpg" target="photo"
onclick="popUp('thepicture.jpg')"><img src="thumb.jpg" alt="picture" /></a>
 
R

Ria Van Heerden

Thanks - is there a better way of displaying a larger view of a thumbnail
???
 
S

SpaceGirl

Ria Van Heerden said:
Thanks - is there a better way of displaying a larger view of a thumbnail
???

Not if you want to turn toolbars off, you have no choice.

If you just want the image to appear in a new window (with the toolbars
turned on) then...

<a href="myBIGpicture.jpg" target="_blank"><img src="myTHUMB.jpg" /></a>

....works. You cannot control anything in the browser without scripting.
Things such as toolbars, popup windows, controlling the history etc etc are
all things that are handled through scripts. You have to keep in mind that
HTML is a mark-up language. It's only designed for displaying information,
not controlling the way applications behave (such as web browsers).
 
R

Ria Van Heerden

Thanks

SpaceGirl said:
Not if you want to turn toolbars off, you have no choice.

If you just want the image to appear in a new window (with the toolbars
turned on) then...

<a href="myBIGpicture.jpg" target="_blank"><img src="myTHUMB.jpg" /></a>

...works. You cannot control anything in the browser without scripting.
Things such as toolbars, popup windows, controlling the history etc etc are
all things that are handled through scripts. You have to keep in mind that
HTML is a mark-up language. It's only designed for displaying information,
not controlling the way applications behave (such as web browsers).
 
W

Whitecrest

I have small thumbnail pics on my site - I want the client to click on them
and then a new window will open without the toolbar and menu and the other
stuff - displaying just the enlarged image. Can somebody help me to do this
I just cant seem to get it right

Use either target = _blank or Javascript to open a new window
onclick='javascript:window.open(...)

or both

<a href='bla.jpg target='_blank' onclick='javascript: window.open(...)>
 
N

nice.guy.nige

oops, should be:

<a href="thepicture.jpg" target="photo"
onclick="popUp('thepicture.jpg')"><img src="thumb.jpg" alt="picture"
/></a>

Or even...

<a href="thepicture.jpg" targer="photo" onclick="popUp('thepicture.jpg');
return false;"> ... etc...

The 'return false' bit stops the file in href being opened if javascript is
available to - and enabled by - the end-user.

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. (e-mail address removed). Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!
 
W

Whitecrest

The 'return false' bit stops the file in href being opened if javascript is
available to - and enabled by - the end-user.

Opps forgot that in my example too
 
M

Mitja

SpaceGirl said:
You should be warned before going down this route, a *lot* of
browsers block popups like this... A good percentage of people

AFAIK browsers are mostly able to distinguish between "wanted" (manually
triggered, like here) and unwanted popups.
 
S

SpaceGirl

nice.guy.nige said:
Or even...

<a href="thepicture.jpg" targer="photo" onclick="popUp('thepicture.jpg');
return false;"> ... etc...

The 'return false' bit stops the file in href being opened if javascript is
available to - and enabled by - the end-user.

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. (e-mail address removed). Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!

Doh. Yes :)
 
T

Toby A Inkster

nice.guy.nige said:
<a href="thepicture.jpg" targer="photo" onclick="popUp('thepicture.jpg');
return false;"> ... etc...

Or better:

<script language="javascript" type="text/javascript">
function popUp(popupURL,popupTarget){
var myPopup = window.open(popupURL,popupTarget,'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=yes,scrollbars=yes,width=550, height=550');
photo.focus();
return !(myPopup);
}
</script>

<a href="thepicture.jpg" target="photo"
onclick="popUp(this.href,this.target);"> <img src="thumb.jpg"
alt="picture" /> </a>

This way the function will return false if the popup opens OK, but if the
popup fails to open, the function will return true, and the link will be
followed normally.

(untested)
 
J

Jeff Thies

function popUp(popupURL,popupTarget){
var myPopup =
window.open(popupURL,popupTarget,'toolbar=0,location=0,directories=0,status=
0,menubar=0,resizable=yes,scrollbars=yes,width=550, height=550');
photo.focus();
return !(myPopup);
}
</script>

<a href="thepicture.jpg" target="photo"
onclick="popUp(this.href,this.target);"> <img src="thumb.jpg"
alt="picture" /> </a>

This way the function will return false if the popup opens OK, but if the
popup fails to open, the function will return true, and the link will be
followed normally.

(untested)

That's my thinking on this also. I haven't had time to test this widely.

Would someone like to throw up a test case to be checked across the range of
popup blockers?

It'll be some time before I can...

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top