I have an mouse over function in javascript, and a clickable div, the thing is that when Im clicking on the image, nothing happends, but outside the image its works perfectly.
<div id="1" onclick="SendRating(this.id);" onmouseover="rateStar(this.id)" ><img src="star.jpg"></div>
and my mouse over function.
function rateStar(rating){
var i = 1;
var ratings = '';
for (i==1; i<=5; i++){
if (i<=rating){
document.getElementById(i).innerHTML = '<img src="star1.gif">';
}
else{
document.getElementById(i).innerHTML = '<img src="star.jpg">';
}
}
}
thanks
IDs cannot start with numbers. Make your code:
and change your javascript to
This may not solve your issue, but you need to do it in any case. Also, think about moving the onclick event to the image itself:
and changing your js to:
So you’re just changing the image source