dimanche 1 mars 2015

div backgroundImage withd input result

I'm using this tech : link to get images from local clients, i don't want save it on my server. Can i (in javascript) set a div backgroundImage width this image ? Now this is my code :



var input9I1 = document.createElement("input");
input9I1.id = "input9I1";
input9I1.type = "file";
input9I1.name = "files[]";
input9I1.accept = "image/*";
input9I1.addEventListener('change', handleFileSelect, false);
td20I1.appendChild(input9I1);


So it was the creation of the input and it work fine. Now the function :



function handleFileSelect(evt){
imgageATraiter = evt.target.files[0];

console.log(imgageATraiter.name);
console.log(imgageATraiter.type);
console.log(imgageATraiter.size);
console.log(imgageATraiter.lastModifiedDate);
console.log(imgageATraiter.lastModifiedDate.toLocaleDateString());

document.getElementById('boite5I1').style.backgroundImage = imgageATraiter.name;}


So what i want is how can i modify the "boite5I1" 's background with my image ? Is it possible ? Thanks to read and have a good day :D


Aucun commentaire:

Enregistrer un commentaire