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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page to fit the browser

Status
Not open for further replies.

mlocurci

MIS
Oct 17, 2001
210
US
I have pages with an image that takes up most of the page. I need the page to fit the image weather the page is max or resized. Any ideas?

-Michael
 
You can see a sample of how this works at:

<!-- TWO STEPS TO INSTALL DYNAMIC SIZED IMAGE:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Original: Ed Churnside -->
<!-- Web Site: -->

<!-- Additional documention available online at -->
<!-- -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! -->

<!-- Begin
function showpic(src, w, h, alt, aln, pw, ph, bw, bh) {
if (src == null) return;
var iw, ih; // Set inner width and height
if (window.innerWidth == null) {
iw = document.body.clientWidth;
ih=document.body.clientHeight;
}
else {
iw = window.innerWidth;
ih = window.innerHeight;
}
if (w == null) w = iw;
if(h == null) h = ih;
if(alt == null) alt = &quot;Picture&quot;;
if(aln == null) aln = &quot;left&quot;;
if(pw == null) pw = 100;
if(ph == null) ph = 100;
if(bw == null) bw = 24;
if(bh == null) bh = 24;
var sw = Math.round((iw - bw) * pw / 100);
var sh = Math.round((ih - bh) * ph / 100);
if ((w * sh) / (h * sw) < 1) sw = Math.round(w * sh / h);
else sh = Math.round(h * sw / w);
document.write('<img src=&quot;'+src+'&quot; alt=&quot;'+alt+'&quot; width=&quot;'+sw+'&quot; height=&quot;'+sh+'&quot; align=&quot;'+aln+'&quot;>');
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<script language=&quot;javascript&quot;>
showpic(&quot;crowd.gif&quot;, 362, 113, &quot;A crows of people&quot;, &quot;middle&quot;);
</script>

<p><center>
<font face=&quot;arial, helvetica&quot; size=&quot;-2&quot;>Free JavaScripts provided<br>
by <a href=&quot; JavaScript Source</a></font>
</center><p>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top