PDA

View Full Version : How do I click on an image and make a new page open up


bamafaye
08-16-2005, 04:28 PM
I am trying to make a page that will have little images and then be able to click on the little image and a new page open up with a bigger image for larger viewing but can't figure out how to do it. Can anyone help me and explain how to do this?

bamafaye

Terminator1138
08-16-2005, 06:11 PM
create a hyperlink to the images source..

PsychoticDude85
08-17-2005, 05:44 AM
I think this is better done in javascript, as for example target blank is not permitted in XHTML 1.0 Strict

Ethan Bedwyr
08-17-2005, 07:50 AM
If your image is http://www.bob.com/images/nasty.gif, you could do this:

<a href="http://www.bob.com/images/nasty.gif"><img src="http://www.bob.com/images/nasty.gif" border="1" width="200" height="150" alt="Click here for a larger image"></a>

The width and height attributes in the <img> tag would be used to specify a smaller size for the image you want them to click on your originating page (e.g., like a thumbnail).

Alternatively, you could make a smaller version of the image (to avoid ugly aspect ratio changes as a result of resizing the image via HTML), and then use the smaller image for the <img src>. The <a href> would still point to the original, larger image.

PsychoticDude85
08-17-2005, 08:16 AM
well yes but that doesnt open a new window, something like

<img src="image.jpg"
width="200"
height="200"
onclick="window.open('page.html', 'win1','width=600,height=600,menubar')"
alt="image">

will open a new page and allows for you to add an onclick="window.close()" to the opened window.

Terminator1138
08-17-2005, 12:02 PM
Some ppl have js disabled though....you can use target self to avoid the blank expression ....plus I do not think this person is thinking about xhtml or anything as of yet.
My advice would be to also read some tutorials .

PsychoticDude85
08-18-2005, 04:22 AM
Good point, but i wish personally that I had used XHTML earlier, it is a very easy transition.

It's a personal choice in the end, because those who turn off Javascript are definately in the minority. The Javascript method is more flexible in how the window ends up, whereas targeted links will just open up a window the same size as the current.

Tutorials are always a good idea though :P it's good to be able to look stuff up easily and that comes through practise all the way.

Terminator1138
08-18-2005, 04:59 AM
I personally use javascript mainly to preload images etc. Many uses that some things cannot do. I agree perhaps someone that starts out should go directly to xhtml....

tmmoose
08-27-2005, 10:05 AM
like this (http://www3.sympatico.ca/terry.mckee/t/comic.html) Simple java script

DCElliott
08-28-2005, 06:58 AM
Do a search (http://www.google.ca/search?sourceid=mozclient&ie=utf-8&oe=utf-8&q=image+popups+javascript) - there are a multitude of popup scripts. Just remember in your link to have <a href="image.gif" onclick="javascript:popup(this.href, options)"> Using this.href allows the link to work conventionally if javascript is disabled. All good popup scripts will enable you to do it this way.

DE