hello guyz, I know javascript is horrible and I know I am asking a PHP community about a javascript problem, but we have to live with it.
Here is the problem, I am implementing a top user choice form, when a user clicks on a choice, it has been passed to top choices table and updated immediately, the table is just to show users, how many choices he has been selected. He cant select more than 10.
Now the problem is, following function is working fine on IE7 I am running on XP and FireFox and also with Safari on MAC. But my client is also using IE7 in her home on Vista. She is telling me that when she selects a choice, it goes in the table but when she deselects it once again goes in the table rather than removing the existing entry from the table.
Below is the code. What could be the problem?
//Function for top 10 choies
function userchoices(choice, voteid)
{
var u_choice=unescape(choice);
var vote=voteid;
//counter variable to traverse 10 locations
var counter=1;
//Loop to traverse the top favorites list and insert at first available space
for(i=1; i<=10; i++)
{
if(document.getElementById("choice_" + counter).innerHTML==u_choice)
{
document.getElementById("choice_" + counter).innerHTML = "";
break;
}
else if(document.getElementById("choice_" + counter).innerHTML=="")
{
document.getElementById("choice_" + counter).innerHTML = u_choice;
if(counter==1 )
{
JSFX_FloatTopDiv();
show_top10('top10');
}
break;
}
else{
counter++;
if(counter==11)
{
alert("You can enter only 10 choices!");
document.myform.elements[vote].checked = false;
break;
}
}
}
}