How can I restrict execCommand('undo') to a <div>?

P

Patrick S

I am using IE 6.0. On a page, I have placed a contenteditable div
which I
want to use as a Rich Text Area. I am using the execCommand method of
the
document to control bold, italics, underlining, and undo for this div.
I
have placed an input element on the page to. All but the undo, are
restricted to working only on the div. How can I restrict the undo to
working on only the div?
Below is the complete page so you can see what I am talking about.
Just paste it into an htm file and traverse to it via your browser.
Type something in the div and the input and then try the buttons. You
will see
that only the undo button affects the input area (none of the other
buttons
do).
<HTML>
<HEAD>
</HEAD>
<BODY>
<form>
<div contenteditable id='editor' style='overflow:scroll; width:100%;
height:100px;'>
<div>some text...</div>
</div>
<br/><br/>
<button ID="Button1"
onclick="editor.setActive(); document.execCommand('bold', false,
null)"
Bold</button>
<button ID="Button2"
onclick="editor.setActive(); document.execCommand('italic', false,
null)"
Italic</button>
<button ID="Button3"
onclick="editor.setActive(); document.execCommand('underline',
false,
null)" >Underline</button>
<button ID="Button4"
onclick="editor.setActive(); document.execCommand('undo', false,
null)"
Undo</button>
<input id='inEditor' type='text'>undo affects me too???</input>
</form>
</BODY>
</HTML>
 
Z

Zifud

Patrick said:
I am using IE 6.0. On a page, I have placed a contenteditable div
which I
want to use as a Rich Text Area. I am using the execCommand method of
the
document to control bold, italics, underlining, and undo for this div.
[...]

You may be better posting this at:

microsoft.public.inetexplorer.scripting

Zif.
 
F

Fred Oz

Patrick said:
It looks like you can't post to that group anymore. Anyone?



I just posted your post there. Check back tomorrow to see how you've
gone.

Regards, Fred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top