Jump to content

execCommand


andyd34

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/175161-execcommand/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.