Connecting Tech Pros Worldwide Help | Site Map

html ?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 12:01 PM
Terry A. Haimann
Guest
 
Posts: n/a
Default html ?

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, 12:01 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default 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.'
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.