When my mouse over function is working, the clickable image wont send the value to my text file, but when I change my div tag to (this) its working but the mouse over function aint .
This is when the mouse over function is working bit not the send ranting value
<div id="1" onclick="SendRating(this,id);" onmouseover="rateStar(id)" value="> <img src="star.jpg"></div>
And this is when my function is sending the value, but the mouse over a’int working.
<div id="2" onclick="SendRating(this.id);" ><img src="star.jpg"></div>
This are my two functions that I’m using.
function SendRating(RatingValue){
var paramas = "rating="+RatingValue;
$.ajax({
type: "POST",
url: "rating.php",
data: paramas,
success: function(responseText)
{
document.getElementById("ContentHolder").innerHTML = responseText;
}
}
);
}
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\">';
}
}
}
when you’re calling a js function from a html tag, using double quotes is best practice.
this will work