execCommand
execCommand
I am using the following to format text within an iframe/text area
-
function formatText(iframe, command, option) {
iframe.contentWindow.focus();
try {
iframe.focus();
iframe.document.execCommand(command, false, option);
iframe.focus();
} catch (e) { }
}
most things work fine when called
-
$('.bold', tb).click(function(){ formatText(iframe, 'bold');return false; });
$('.italic', tb).click(function(){ formatText(iframe, 'italic');return false; });
$('.underline', tb).click(function(){ formatText(iframe, 'underline');return false; });
$('.$class_name', tb).click(function(){ formatText(iframe, 'InsertImage', '$url/$image');
except
-
"$('.color_$key', tb).click(function(){ formatText(iframe, 'ForeColor', '#666');
Does anyone have any suggestions