45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
|
entities = new Array();
|
||
|
chars = new Array();
|
||
|
|
||
|
entities[entities.length] = 'ô';
|
||
|
chars[chars.length] = "ô";
|
||
|
entities[entities.length] = 'é';
|
||
|
chars[chars.length] = "é";
|
||
|
entities[entities.length] = 'ê';
|
||
|
chars[chars.length] = "ê";
|
||
|
entities[entities.length] = 'à';
|
||
|
chars[chars.length] = "à";
|
||
|
entities[entities.length] = 'ô';
|
||
|
chars[chars.length] = "ô";
|
||
|
entities[entities.length] = 'Ê';
|
||
|
chars[chars.length] = "Ê";
|
||
|
entities[entities.length] = 'û';
|
||
|
chars[chars.length] = "û";
|
||
|
entities[entities.length] = 'ü';
|
||
|
chars[chars.length] = "ü";
|
||
|
entities[entities.length] = 'Ä';
|
||
|
chars[chars.length] = "Ä";
|
||
|
entities[entities.length] = 'ä';
|
||
|
chars[chars.length] = "ä";
|
||
|
entities[entities.length] = 'ö';
|
||
|
chars[chars.length] = "ö";
|
||
|
entities[entities.length] = 'ß';
|
||
|
chars[chars.length] = "ß";
|
||
|
|
||
|
|
||
|
function replaceEntities(theString) {
|
||
|
for (var i = 0; i < chars.length; i++) {
|
||
|
theString = eval('theString.replace(/' + entities[i] + '/g, chars[i])');
|
||
|
}
|
||
|
return theString
|
||
|
}
|
||
|
|
||
|
function entityAlert(theString) {
|
||
|
theString = replaceEntities(theString);
|
||
|
alert(theString);
|
||
|
}
|
||
|
|
||
|
function entityConfirm(theString) {
|
||
|
theString = replaceEntities(theString);
|
||
|
return confirm(theString)
|
||
|
}
|