Connecting Tech Pros Worldwide Help | Site Map

html ?

  #1  
Old July 20th, 2005, 01:01 PM
Terry A. Haimann
Guest
 
Posts: n/a
If you want to display an image on a page and you don't know what its
physical size is going to be and you want it to scale down to the size of
the web page, how would you do that?

Thx, Terry
  #2  
Old July 20th, 2005, 01:01 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a

re: html ?


"Terry A. Haimann" <terry@yngstr.oldboy.com> writes:
[color=blue]
> If you want to display an image on a page and you don't know what its
> physical size is going to be and you want it to scale down to the size of
> the web page, how would you do that?[/color]

What page? What else is on the page?

First, you find the size of the browser window:
<URL:http://jibbering.com/faq/#FAQ4_9>
Call them "width" and "height".

Then you can create a new page in the same window with the image in:

document.write("<img src='img.png' style='width:"+width+
"px;height:"+height+"px;'>")
document.close();


/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: xhtml 1.0, xhtml 1.1, html 4.01, or html 5.X? -Guy Macon Guy Macon answers 6 July 26th, 2008 02:45 PM
Help on HTML server control vs HTML control serge calderara answers 5 November 19th, 2005 07:30 PM
Passing values from a function generated html. cirillo_curiosone answers 1 July 23rd, 2005 01:27 PM
creating and sending html email from asp server script Francois Keyeux answers 4 July 22nd, 2005 02:20 AM