SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with execCommand on FontName

    I am attempting to write a wysiwyg text editor to use in back-end site administration forms. It's working pretty well, aside from one error: when I hilight a large block of text and change the font, the change only applies to portions of the text selected (which appears to be random portions). Here is the javascript I'm using:

    Code:
    function applyFont() {
     document.all.rtEditor.focus();
     document.execCommand("fontname", false,  document.all.fontNameSelector.value);
    }
    Where am I going wrong?
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Mind giving a hint as to what rtEditor and fontNameSelector are -- a textarea and selection list?

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rtEditor is the ID of the contenteditable div that's used to edit the text, and fontNameSelector is the id of the select list used to choose fonts.
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone know?
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •