homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

Stylesheets for MS DHTML Editing Component

10+ Year Member

Msg#: 93 posted 8:55 am on Jul 30, 2002 (gmt 0)

I want to implement my own stylesheets in the MS DHTML Editing Active-X control. Does any one know hoe to do this?




10+ Year Member

Msg#: 93 posted 1:00 pm on Jul 31, 2002 (gmt 0)

Your question could have done with a bit more detail!

For a start the DHTML control is deprecated and I have been using the a DIV with CONTENTEDITABLE enabled (not sure what the MS jargon for this is but it is the replacement to the DHTML editing control)

It automatically respects any styles defined in the page containing it.

As for allowing the user to apply styles to their input I used something like this (Javascript):

function strapline()
cursorPos.execCommand("formatblock",false, "<p>")
var el = cursorPos.parentElement();
el.className = "strapline";

cursorPos is set by a function called on keydown and mousedown in the DIV which does:

after making sure the selection is of type 'text'. If it is type 'control' it does:
el = document.selection.createRange();
cursorPos= el(0);

It only seems to format whole paragraphs even if you select sub-blocks. I don't know what other formats other than <p> that the execCommand("formatblock") accepts and can't find anything on MSDN...

I have also tried this:

function anystyle(mystyle)
cursorPos.className = mystyle;

I also played with something like this:


but you need to get an element into el first...

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved