SOLUTION 1:
Some time ago i wrote a script for displaying images in new window. Instead of opening the window of selected width and height, i made a general html file that resizes itself one loaded to fit the image width and height. You pass the image url by the url to the html file, like this:
image.html?img=http://www.
Here is the code, there you will see all the propierties and methods:
<html>
<head>
// For nor showing image toolbar
<meta http-equiv="imagetoolbar" content="false">
// A title...
<title>Image Show</title>
// The resize function, we make a fix for netscape users and use document.images[0]
// because our image is the first one, it it will be the second.. we will use document.images
// [1] and so on.... If the image is too much big, we resize the image in runtime to a max
// of 300 width and 450 height. And we center the window in the screen.
// Anything more you need ? : )
<script language="javascript">
<!--
var i=0;
function resizeme() {
if (navigator.appName == 'Netscape') i=40;
if (document.images[0].width < 300) document.images[0].width=3
if (document.images[0].height
if (document.images[0]) window.resizeTo(document.i
if (document.images[0]) window.moveTo((screen.avai
}
//-->
</script>
</head>
<body oncontextmenu="return false" onclick="self.close();" onload="resizeme();" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
// Here we read the ?img= parameter to get the url of the image
// If the image doesn't load or gives an error, we show an error.gif file !
// And to close.. you only need to click the image. : )
<script language="JavaScript">
<!--
var is_input = document.URL.indexOf('=');
if (is_input != -1)
{
addr_str = document.URL.substring(is_
document.write("<img onError=this.src='http://w
}
else
{document.write("Any problem found, have you passed the url of th image ? Usage: image.html?img=urlofanimag
-->
</script>
SOLUTION 2:
As you see. i get the image width an height with document.images[numberofim
<img name=thisimage src=http://www.somewhere.c
then you can show by javascript document.all.thisimage.wid
SOLUTION 3:
In your case , If you need NOW these variables you can use them in the img code, just like this:
<img src=http://www.server.com/
Any of the three serve your needs ?
If you need more help just ask, and sorry gfor the bad english, is not my native language. : )
Main Topics
Browse All Topics





by: duerraPosted on 2003-10-08 at 22:01:41ID: 9518393
Don't you mean "img.width", instead of "image.width"? That could be where your error is.