Sorry, I`ve mistaken in coping my sript to the post

, the original one do has div's name
"js/show_map.js" file
Code:
draw drawImges ("mapscreen", “img1”,”imges/001.jpg”,800,800);
function drawImges(table_name,id,path, width, height){
var s_table = document.getElementsByName(table_name);
var newImage = new Image(),img;
newImage.onload=function () {
img=document.createElement('IMG');
img.id=id;
img.src=path;
document.body.insertBefore(img,document.body.childNodes[0]);
document.getElementById(id).style.width = width + "px";
document.getElementById(id).style.height = height + "px";
}
newImage.src= path;
}
HTML document
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Fails</title>
<script type="text/javascript" src=js/show_map.js></script>
</script>
</head>
<body>
<div id="screen" name=”uuuu” style="width:600px;height:500px;">
</div>
<script>
drawImges();
</script>
</body>
</html>
I’ve changed
Code:
document.body.insertBefore(img,document.body.childNodes[0]);
for
Code:
s_table[0].appendChild(img);
and it works. The image begins in <div id="screen" name=”uuuuh” style="width:600px;height:500px;">, but it’s spread all over the body and not inside of the div’s borders, as I pretend. I want to see a portion of the picture cut by dimensions of the div (not a scaled image).
What do I do wrong?