...

View Full Version : open popup window with image



rickfink
06-23-2009, 04:10 PM
Hey guys,

I need to make a image open a popup window, I know how to do it like this:

function load2() {

var load = window.open('pictures','','scrollbars=no,menubar=no,height=800,width=840,resizable=yes,toolbar=no,lo cation=no,status=no');

}

then on the link just have it go to javascript:load2()

But I have a ton of different links and don't want a bunch of code in the beginning of my pages. Is there a way to make the first part just the dimensions of the new window but then when I actually make the link, I could put where I want it to link to? Like javascript:load2(pictures). or something like that?

mike182uk
06-23-2009, 04:44 PM
one way of doing it is

firstly put all your js in an external file and include it on all the pages of site that require it, so then you can chop and change the code once, and it reflect across the site.



<script src="YOUR SCRIPT.js"></script>


then i would write a standard function that takes the link as an argument.

like so



function popUp(link){
var window = window.open('pictures','','scrollbars=no,menubar=no,height=800,width=840,resizable=yes,toolbar=no,lo cation=no,status=no');
var link = link

//yada yada rest of code

}


then when you want to call it



<a href="#" onlclick="popUp('/img.jpg')> my link </a>

rickfink
06-23-2009, 06:05 PM
Thanks that worked!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum