Source Code: Setting the Font Size List

  •  07-12-2004, 12:51 PM

    Source Code: Setting the Font Size List

     
    Please try the following code. Keep me posted.

     

    <script language="JavaScript" type="text/javascript" >

    function changeSize(editorID,value) {

            EditorID = editorID+"_editBox";

            var editor = document.getElementById(EditorID);

            editor.focus();

            var sel = editor.document.selection.createRange();

        

            if (sel.htmlText != "")

                sel.pasteHTML( '<font style="font-size:' + value + 'px">' + sel.htmlText + '</font>' );

    }

    </script>

     
    <%

        DropDownList temp = new DropDownList();

        temp.Attributes.Add("OnChange","changeSize('Editor1',this[this.selectedIndex].value)");

        temp.Items.Add(new ListItem("Font Size List",""));

        temp.ID = "FontSizeList";// This ID will be used in template

        temp.Items.Add(new ListItem("10","10"));

        temp.Items.Add(new ListItem("12","12"));

        temp.Items.Add(new ListItem("14","14"));

        temp.Attributes.Add("style","width:40; margin-left:5;font:8pt Verdana;vertical-align:middle;");

        Editor1.RegisterCustomButton(temp); // don't forget register the button to the editor

    %>


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread