Img size

liunx

Guest
Hi - how do I make an image fit into the full width of the frame, while the frame is different sizes depending on resolution etc...<br />
<br />
Or should i go to the js section with this question???<br />
<br />
Regards <br />
Matty<!--content-->You preload the image first.<br />
<br />
Then get the window size..<br />
now you re-size the image according to the window size<br />
<br />
image.width = W;<br />
image.height = H;<!--content-->image.width = frame.availWeight;<br />
image.height = frame.availHeight;<br />
<br />
Type of thing or what?<br />
<br />
Could you perhaps post a sample code listing.<br />
<br />
Regards mw<!--content-->yeah something like that..only you will have to find out the internal size of that frames window...<!--content-->but i am feeling a bit stupid lately - i have forgotten all basics -etc...<br />
That'll show me to go on holiday for 3 weeks...<br />
<br />
Could you explain to me how i would get the internal frame size. PLEASE <br />
<br />
<br />
Thanks...<!--content-->I guess in that case...the code below should do it.<br />
<br />
<br />
<script type="text/javascript"><br />
<br />
<!--<br />
function Process(){<br />
if(document.images){<br />
var img = new Image();<br />
img.src = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->"someSrc.gif";<br />
var imageSizes = getPosition();<br />
img.width = parseInt(imageSizes[0]);<br />
img.height = parseInt(imageSizes[1]);<br />
}<br />
}<br />
<br />
function getPosition(){<br />
var w =0; h = 0;<br />
if(document.all){<br />
w = (document.body)? parseInt(document.body.clientWidth) : parseInt(document.documentElement.clientWidth); <br />
h = (document.body)? parseInt(document.body.clientHeight) : parseInt(document.documentElement.clientHeight);<br />
return new Array(w,h);<br />
}else{<br />
w = parseInt(window.innerWidth);<br />
h = parseInt(window.innerHeight);<br />
return new Array(w,h);<br />
}<br />
}<br />
//--><br />
</script><br />
</head><br />
<br />
<body class="body" onload="Process();"><br />
<br />
<br />
<br />
Make sure you call process when you need it,I just call it onload to make point...<br />
<br />
FYI...the above is almost an absolute window internal size findong code.njoy...:D<!--content-->That works <br />
<br />
GRAND!!!<br />
:D <br />
<br />
Thanks alot :D :D :D :D :D :D <br />
<br />
Regards <br />
MW<!--content-->:p <br />
<br />
You are most welcome....<!--content-->
 
Back
Top