after considering moonwave99 's comment as well, i ended up with a different solution..
first of all i found out, that condition check failed, because in the responseText there was an extra white space..so initially i used
xmlhttp.responseText.trim();
in order to remove unwanted characters...but it still didn't feel right the fact that i was passing js code as string from php back to js.. and i decided to use json.. so on the php side, i used json encode
$options = array($row['option1'],$row['option2'],$row['option3'],$row['option4'],$row['option5'],$row['option6'],
$row['option7'],
$row['option8'],
$row['option9'],
$row['option10']
);
echo json_encode($options);
and on the javascript side i used
var jsObject = JSON.parse(xmlhttp.responseText);
var jslength = jsObject.length;
for (i=0; i<jslength; i++){
document.getElementById(jsObject[i]).className += ' colour';
}