javascript - HTML localStorage CSS Issues? -


okay i've managed after couple of hours call on image using html localstorage system have 1 problem called on image.... can't dictate goes..... sits @ bottom of page code purely javascript..... i've tried putting in div , changing position won't budge suggestions.... heres code thats calling image across:

    window.onload = function() {  var picture = localstorage.getitem('img');  var image = document.createelement('img');  image.src = picture;  document.body.appendchild(image); }; 

how can edit position on page hight etc......................? appreciated!

you're appending image document body, likewise, it's going added bottom of page.

you can set properties of image.style change image's css properties such height (image.style.height) , width (image.style.width).

to position elsewhere on page, can change it's display properties

image.style.position = "absolute"; //(for example) image.style.top = "50px"; //drops image down 50px top of page 

or, can add different part of dom altogether:

document.getelementbyid('id_of_your_div').appendchild(image); 

hope helps.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -