|
-
June 7th, 2005, 08:13 AM
#1
Pop Up
I have a link to an image I open in a pop up window using this javascript function below to resize the popup window according to the dimensions of the image:
function enlarge(image)
{
var i = new Image();
i.src = image;
var x = i.width;
var y = i.height;
x+=40;
y+=40;
// window.status for degugging:
window.status = image + " = " + x + " x " + y + " pixels";
var z = "scrollbars=yes,resizable=yes,,status=no,location=no,toolbar=no,width=" + (x) + ",height=" + (y);
win=window.open(image,"image",z);
}
The first time I click on the link the function doesn't manage to get the width and the height of the image
How can i solve this problem? 
thanks in advance
Last edited by elektroman; June 7th, 2005 at 08:17 AM.
-
June 7th, 2005, 02:48 PM
#2
Re: Pop Up
Umm, not sure of the error, but you could do something to help out debugging. Throw the code into a try..catch block (the x and y part):
Code:
try {
var x = i.width;
var y = i.height;
}
catch(e) {
// e is the error object. You can alert the message or other stuff here.
alert(e.message);
}
Find out what alerts from this code. If nothing alerts, the issue would deal with the window buffer, which is involved in all languages, but I won't confuse with with all that.
*9-11-01* Never Forget; Never Forgive; Never Relent!
"If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|