Programmatically set font - Javascript

Last post 04-07-2014, 3:45 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  04-04-2014, 7:33 PM 80226

    Programmatically set font - Javascript

    I have looked through the documentation and I cannot see a way to set the font and font size programatically in the drop down. Based on a user's preferences, I would like to automatically set the selected font and font size when RTE loads. 

     

    How can I accomplish this? 

  •  04-07-2014, 3:45 AM 80227 in reply to 80226

    Re: Programmatically set font - Javascript

    Hi erdnase,

     

    Please try the example  below, it shows you how to change the font name/size dropdown list in javascript when editor load.

     

    1. <%@ Page Language="c#" ValidateRequest="false" %>  
    2.   
    3. <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>  
    4.   
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    6. <html xmlns="http://www.w3.org/1999/xhtml">  
    7. <head>  
    8.   
    9. </head>  
    10. <body>  
    11.     <form id="Form1" method="post" runat="server">  
    12.         <RTE:Editor ID="Editor1" runat="server"  />  
    13.   
    14.     </form>  
    15. </body>  
    16. </html>  
    17. <script type="text/javascript">  
    18.   
    19.     function RichTextEditor_OnCoreLoad(editor) {  
    20.         var config = editor._config;  
    21.         //change the configuration settings  
    22.         config.fontnamelist = "Arial";  
    23.         config.fontsizelist = "8px";  
    24.     }  
    25. </script>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML