Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is wrong with this code !

Status
Not open for further replies.

Newbie2

MIS
Sep 13, 2001
10
GB
whenever I use the page that references this code it gives me an error on page message "object expected".
If I comment out try..catch then it works fine.
Even with nothing in the try..catch it has the same problem.

I am sadly confused!

function displayImage(url, windowName)
{
popupWin = window.open( url, windowName, 'width=200,height=200,scrollbars=no,maximize=no,minimize=no,resizable,dependent=yes' );
hgt = popupWin.document.images[0].height + 60;
wdt = popupWin.document.images[0].width + 30;

try
{
} catch (e)
{
if e="Error" alert("Error thrown");
}
popupWin.window.resizeTo(wdt, hgt);
}
 
May be it in the way you call taht function?
I used:
<a href=&quot;#&quot; onClick=&quot;displayImage('img.html','imgWin')&quot;>Show img</a>

and img.html I have only <img src=&quot;&quot;>

and it worked fine.

HTH,
D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top