Here is a simple code fiddle: http://ift.tt/1CbIJue which is not working for me for 2 days straight.
In my website, the 2nd, i.e. the
flag
image style display change works, but the 1st, i.e. the
upvote
image style display change does not work. However in Fiddle, both of the style display change functions are not working.
HTML:
<img id='upgrey' class='up' src='http://ift.tt/1ekJrdt' width='26px' onclick='upvote();'>
<img id='upgold' class='up' src='http://ift.tt/1CbIJui' width='26px' style='display:none'>
<img id='flaggrey' class='flag' src='http://ift.tt/1ekJpSA' height='26px' onclick='flag();'>
<img id='flagred' class='flag' src='http://ift.tt/1CbIIqd' height='26px' style='display:none'>
JS
function upvote() {
document.getElementById("upgrey").setAttribute("style", "display:none");
document.getElementById("upgold").setAttribute("style", "display:block");
}
function flag() {
document.getElementById("flaggrey").setAttribute("style", "display:none");
document.getElementById("flagred").setAttribute("style", "display:block");
}
I thought this was the bread and butter functionality of JavaScript and no idea what else I can do at all to fix this.
Ah, when the simple things fail to work!
Aucun commentaire:
Enregistrer un commentaire