Could someone please take a look at the script below. the code positions a background image at 0px -12px. But I need to replace these numbers with variables x and y which consequently, I will be changing dynamically.
I need to use x and y in the code, but I don't know how to do it properly.
Code:
<script type="text/javascript">
function ini() {
var list=document.getElementById("nav_list");
x=0;
y=-12;
list.style.backgroundPosition='0px -12px';
}
window.onload=ini;
</script>
for example
Code:
list.style.backgroundPosition='xpx ypx'; does not work
list.style.backgroundPosition=x+"px" y+"px'; does not work either
thank you very much for help.