Click to See Complete Forum and Search --> : Javascript Pop-up issue...


rednil
11-24-2004, 02:56 PM
I'm using a script that onClick grabs a specified image and tosses it in the middle of this popup images document i have.

it works great in IE....but does not load the image in FireFox.

I was wondering if someone could point me in the right direction.

Here's the stuff:

There are 2 documents involved here, and then a folder with the images...

The <script> tag in the header of the main document:
<script type="text/javascript" language="javascript">
function openCenteredWindow( strImage )
{
var intLeft = (screen.width - 500) / 2;
var intTop = (screen.height - 500) / 2;
window.open( 'popup.html?image=' + strImage , 'Popup', 'status=yes,scrollbars=no,resizable=yes,width=500,height=500,left=' + intLeft + ',top=' + intTop );
}
</script>

The <div> tag that contains the "onClick":
<div class="Thumb_1" onClick="javascript: openCenteredWindow( 'myPicture' );"></div>

The <script> tag on the pop-up window:
<script type="text/javascript" language="javascript">
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
var id = getQueryVariable('id');
</script>

The <body> tag on the pop-up window:
<body onLoad="javascript: large_design.src='images/' + getQueryVariable('image') + '.jpg';">

The <img> tag in the body of the pop-up window:
<img name="large_design" id="large_design" src="" alt="">

[ The folder with the images is titled "images" and contains: myPicture.jpg and myPicture2.jpg ]

There is a working version of this here: http://www.evileyebrows.com

click on the "pics" link

Nigel McFarlane
11-24-2004, 06:33 PM
In the onClick handler, you don't need the javascript: prefix.

That's not your problem though. This URL doesn't work at all:

http://www.evileyebrows.com/images/myPicture.jpg