I have to call the following javascript function
function changeExampleField(firstValue, changeId, field, wordToChange)
{
var exampleTxtElem = document.getElementById(changeId);
var newTxt = field.value;
exampleTxtElem.innerHTML = firstValue.replace(wordToChange, newTxt);
}
The problem at this is, I get the value of "firstValue" from the database, it is a String and it can contain single quotes. For example:
I get a value from the database which operates
<input class="" type="text" name="text_label.test_virus_connection" value="test" size="50" maxlength="50" id="a_text_label.test_virus_connection" onkeyup="changeExampleField('Verbindung testen', 'example_label.test_virus_connection', this, 'test')" onFocus="dispHelp('')">
But i can get values from the database which dont operates
<input class="" type="text" name="text_pass_sprachtest.label.execute.successfull" value="test" size="50" maxlength="50" id="a_text_pass_sprachtest.label.execute.successfull" onkeyup="changeExampleField('Bewerbung(en) erfolgreich auf 'Sprachtest(s) bestanden' gesetzt!', 'example_pass_sprachtest.label.execute.successfull', this, 'test')" onFocus="dispHelp('')">
My question is: is there a different way to call the function (for example with properties or so)? Or a different way to solve this problem?