2009-03-16

IE6 issues with javascript with accents

The following code won't run with IE6, but does run perfectly on IE7:

function changeFunction(obj) {
var div = null;
var idScheda = '';
var o = obj;

alert('ID: ' + obj.id); // undefined
alert('TO: ' + typeof(obj.id)); // undefined
alert('IF: ' + (typeof(obj.id) == 'undefined')); // true

if (typeof(obj.id) == 'undefined') {
// compatibilità
alert('OK');


Basically, the problem was that we never got the OK alert, even though we got the true alert, one line before. We found out the error was related to the accent in compatibilità: changing that into compatibilita made the whole thing run on IE6 as well.

No comments:

Post a Comment