![]() |
Drawing images in <div> fails
Hi all! I,m trying to insert images to <div>. I can insert the images in <body> of the document with this code
Code:
function drawImges(table_name,id,path){Code:
s_table.appendChild (img);Code:
s_table.insertBefore(img,s_table.childNodes[0]);Code:
document.body.insertBefore(img,document.body.childNodes[0]);Looking for help, please.:) |
give the div an id and do
Code:
document.getElementById("mydiv").appendChild(img);s_table[0].appendChild(img); but you would have to wonder why) |
Sorry, I`ve mistaken in coping my sript to the post :o, the original one do has div's name
"js/show_map.js" file Code:
draw drawImges ("mapscreen", “img1”,”imges/001.jpg”,800,800);Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">Code:
document.body.insertBefore(img,document.body.childNodes[0]);Code:
s_table[0].appendChild(img);What do I do wrong? |
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> |
It works :) Thank you very much :thumbsup:
|
| All times are GMT +1. The time now is 07:05 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.