Image in new window
First, I wanted to let you know that I did search several times, and did a lot of reading, before posting this question.
<a href="this is the big picture" target="functionnamehere?()"><img src="thumbnail"></a>
I know that it's not right, and I thought that maybe I would need to do some sorta onClick thing, but I'm just rather confused right now. I guess I could've been wrong in assuming that this is an easy task, but I see sights all over the place that do something like this, or similiar to it, and I was looking to do the same.
window.open("the URL would be here, but it's gonna be different for reach picture","bigpicture","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=640, height=480" )
Do you need to write it in a function?
If not, here is my code to have a link to new window for larger image, from one of my sites:
<a href="#" onClick="window.open('larger_views/house_abington.html','','height=400,width=500');">
<img src="images/houses/abington.jpg" alt="Abington, a Devco Home" height="100" border="0"></a>
If there is a reason you want it in a function, I am pretty certain you can't place the call to the function in the target=""
Instead you will need <a href="#" onclick="your function(imagename)"> and your function would need to take the image name as a parameter.Make sense?
I tried the method of passing the imagename as a variable of the function, but the name I specify in the function such as
It says that "nameofpicture" is undeclared.
If you want to get an idea of exactly what I'm doing, it's here:
This is just one gallery of images, and I'm looking to use the same function to call up these new windows for all pictures by specifying the function. See what I'm sayin?
Ignore the current image sizes and all that for now, I'm trying to get this to work correctly first.
Added: Ahh, ok, I fixed one problem. There needed to be single quotes around the variable name, but now to make the picture actually show up.
Yeah, I can't seem to be able to for the actual image to appear.
It just continues to try and open whatever I have for the "URL," which I have set as the variable name
Looks like you made some progress. I went to the page, and after it loads I can click once on any pic and get the larger image in new window. But then it doesn't work again, for that one or any of the others. Not sure what this line is your js is for:
if( typeof(w) == "object" ) w.close();
but I think that's why it only works one on page load.
OK, I just removed that line and applied the js to a gallery page I have and it works fine. This was on Mac IE and Safari. On Mac NS 7 it worked even with that line. But I think ix nay on that ine lay.