Open new window issue

Hi there, I want to open a new window on click of my javascript gallery images. Have been trying lots of variations but dont really know what Im doing and need to get this sent to someone today. I know I really need to learn JS properly, can anyone could help me get out of a pickel? then I really will get studying.

this is the JS funtion that makes my gallery work…

domReady(function()
{
                var instanceOne = new ImageFlow();
                instanceOne.init({ ImageFlowID:'slider' });
                
});

Im ment to add the below to it for opening a fresh window…


var target_2 = new ImageFlow();
target_2.init({ ImageFlowID: 'target_2', 
                    onClick: function() {window.open(this.url, '_blank', 
                                'width=500,height=500,left=200,top=200');} });

do I just sit this below the first bit of JS?

Now the problem Im having, is how to reference the second function in my html.I have been trying to ref ‘target_2’ in the html for each image to no avil,

could anyone tell me how to add it? the simple ‘target_blank’ in html doesnt work with this.

heres the html for one of the images

  <div id="slider" class="imageflow"> 
	img src="img/magda.jpg" longdesc="http://www.magda-stawarska-beavan.com/inheritance.php" width="200" height="148" alt="Sound and Video Artist" /> 

many thanks

btw I did try adding an anchor but the whole thing stopped working

Ive found the site I got this gallery from, and he has a bit of javascript for opening a new window…

var target_1 = new ImageFlow();
target_1.init({ ImageFlowID: 'target_1, 
                    onClick: function() {window.open(this.url, '_blank');} });

Ive looked at his code and…
I have added this to my javascript file, but my div already has an id and if I change this to target_1 the gallery doesnt work ofcourse, do you know how I can mix the two bits of js code togther so they have one id?

this is my other bit of js…

domReady(function()
{
	var instanceOne = new ImageFlow();
	instanceOne.init({ ImageFlowID:'slider' });
	
});
<div id="slider" class="imageflow"> 
	<img src="img/e2la.jpg" longdesc="http://www.e2la.co.uk" width="200" height="148" alt="Lanscape Architect" />

this is his site (I tried emailing him for support to no avail.

http://finnrudolph.de/ImageFlow/Examples#New_window

any ideas apreciated

heres my html again for good messure…

<div id="slider" class="imageflow"> 
	<img src="img/e2la.jpg" longdesc="http://www.e2la.co.uk" width="200" height="148" alt="Lanscape Architect" />

Sorry, I only know how when using an anchor or with a lightbox (also requires anchor I believe). Why not just use an anchor that’s what it’s for.

your a star thankyou. I’ve been looking at the below code in the sitepoint article, how can I adapt this to work with the html I have below without hrefs or a tags? if you would be so kind, have a design interview tomorrow and going to look pretty silly if I cant sort this.

function externalLinks() {   
 if (!document.getElementsByTagName) return;   
 var anchors = document.getElementsByTagName("a");   
 for (var i=0; i<anchors.length; i++) {   
   var anchor = anchors[i];   
   if (anchor.getAttribute("href") &&   
       anchor.getAttribute("rel") == "external")   
     anchor.target = "_blank";   
 }   
}   
window.onload = externalLinks;

this is the begining of my html, each image in the rotating gallery opens the website in the same window, I just want a new window each tiem.

	<div id="slider" class="imageflow"> 
	<img src="img/e2la.jpg" longdesc="http://www.e2la.co.uk" width="200" height="148" alt="Lanscape Architect" />

thanks a million

jackie

thanks for getting back to me, I have been looking and think I need to use rel=“” rather than target and then some javascript but getting very confussed as I dont have an ‘a’ tag as in most of the examples, but an img src and longdesc. need to try and sort this tonight.Will keep looking.

Show me an example of what you want and I’ll give my opinion…

I still havent managed to resolve this, nearly 200 people have looked and no one written anything, have I done something wrong? is it not clear? or tricky?
any advice? thanks

Hello, no one responded because if you google this you’ll get about 50 pages of relevant results. A lot I’d copy and paste stuff. See how that goes.

I dont know what you mean could you show me? thanks

I tried this a few days ago but couldnt understand how to get it to work with my image as the link, sorry if Im being stupid, I know the below isnt right as it should have a text link between >< at the end, but I want the image to be the link, do you know how I jig the below? thanks for still being up Eric.

<div id="slider" class="imageflow"> 
	<a href="http://www.e2la.co.uk" img src="img/e2la.jpg" alt="Lanscape Architect" onclick="window.open('http://www.e2la.co.uk','','width=800,height=600');return false"></a>

Here is how with a anchor http://www.visibilityinherit.com/code/popup.php

No problem, wrap the anchor around the the img and the href in the anchor points to the large image (or whatever).