View Single Post
Old 10-05-2012, 04:59 AM   PM User | #4
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
you need to set the containing div's overflow to hidden, otherwise it will stretch to accommodate the contents.

But the whole thing seems weird to me. I'd do it more like this:

Code:
<body>
<div id="screen" name="uuuu" style="width:600px;height:500px;overflow:hidden"></div>
<script type="text/javascript">
function drawImges(thediv,id,path, width, height){
  var newImage = new Image(),img;
  newImage.onload=function ()  {
    img=document.createElement('IMG');
    img.id=id;
    img.src=path;
	img.style.width = width + "px";
	img.style.height = height + "px";
   document.getElementById(thediv).appendChild(img)
     }
 newImage.src= path;
}
drawImges("screen", "img1","imges/001.jpg",800,800);
</script>
</body>
xelawho is offline   Reply With Quote
Users who have thanked xelawho for this post:
Drunklord (10-05-2012)