Jan 11, 2002 #1 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
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
Jan 14, 2002 #2 paulorlowski Programmer Jul 10, 2001 56 US You can see a sample of how this works at: http://javascript.internet.com/page-details/dynamic-sized-image.html <!-- 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="JavaScript"> <!-- Original: Ed Churnside --> <!-- Web Site: http://www.dragonquest.com/inddpl.htm --> <!-- Additional documention available online at --> <!-- http://www.dragonquest.com/dplsspic.htm --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- 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 = "Picture"; if(aln == null) aln = "left"; 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="'+src+'" alt="'+alt+'" width="'+sw+'" height="'+sh+'" align="'+aln+'">'); } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <script language="javascript"> showpic("crowd.gif", 362, 113, "A crows of people", "middle" </script> <p><center> <font face="arial, helvetica" size="-2">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </center><p> Upvote 0 Downvote
You can see a sample of how this works at: http://javascript.internet.com/page-details/dynamic-sized-image.html <!-- 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="JavaScript"> <!-- Original: Ed Churnside --> <!-- Web Site: http://www.dragonquest.com/inddpl.htm --> <!-- Additional documention available online at --> <!-- http://www.dragonquest.com/dplsspic.htm --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- 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 = "Picture"; if(aln == null) aln = "left"; 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="'+src+'" alt="'+alt+'" width="'+sw+'" height="'+sh+'" align="'+aln+'">'); } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <script language="javascript"> showpic("crowd.gif", 362, 113, "A crows of people", "middle" </script> <p><center> <font face="arial, helvetica" size="-2">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </center><p>
Jan 14, 2002 Thread starter #3 mlocurci MIS Oct 17, 2001 210 US Getting there...how do you adjust size? Upvote 0 Downvote