html ?

T

Terry A. Haimann

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
 
L

Lasse Reichstein Nielsen

Terry A. Haimann said:
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top