+ 1
How to set background image using javascript?
2 Answers
+ 3
you can create function in your script code and then create variable. for the variable you can use
document.getelementbyid(/your parameter/).style.background-image = url('/your image/');
just check on this site
http://stackoverflow.com/questions/18665702/javascript-setting-background-image-of-a-div-via-a-function-and-function-paramet
+ 2
<div id="div_id"></div>
<script type="text/javascript">
var bg = document.getElementById('div_id').style.background-image = url(' images/test.png');
</script>