Я исправил проблему, изменив var sScript на
var s = document.createElement('script');
s.type = 'text/javascript';
var code = 'function check(browser){';
code += 'document.getElementById("answer").value=browser;}';
try {
s.appendChild(document.createTextNode(code));
document.body.appendChild(s);
} catch (e) {
s.text = code;
document.body.appendChild(s);
}
а как перевести значение в HTML?