185
rated 0 times
[
188]
[
3]
/ answers: 1 / hits: 15714
/ 10 Years ago, wed, october 1, 2014, 12:00:00
Ok, maybe its a stupid question with a little bug, but I'm trying fix this and I can not:
<style>
.pagar a {
width: 200px;
height: 85px;
display: block;
background-image: url('imagens/pagar.jpg');
background-repeat: no-repeat;
}
.pagar a:hover {
background-image: url('imagens/pagar-hover.jpg');
background-repeat: no-repeat; }
</style>
<script>
function clickado() {
document.getElementsByClassName('pagar')[0].style.backgroundImage = 'url(imagens/pagar-clickado.jpg)';
}
</script>
HTML:
<div class=pagar id=pagar ><a href=# onclick=clickado()></a></div>
The problem:
The .style.backgroundImage just does not change to imagens/pagar-clickado.jpg, the the path is correct, I do not get error in console and ('pagar')[0] is also correct too.
More From » css