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)"
onclick="editor.setActive(); document.execCommand('italic', false,
null)"
onclick="editor.setActive(); document.execCommand('underline',
false,
null)" >Underline</button>
<button ID="Button4"
onclick="editor.setActive(); document.execCommand('undo', false,
null)"
</form>
</BODY>
</HTML>
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)"
<button ID="Button2"Bold</button>
onclick="editor.setActive(); document.execCommand('italic', false,
null)"
<button ID="Button3"Italic</button>
onclick="editor.setActive(); document.execCommand('underline',
false,
null)" >Underline</button>
<button ID="Button4"
onclick="editor.setActive(); document.execCommand('undo', false,
null)"
<input id='inEditor' type='text'>undo affects me too???</input>Undo</button>
</form>
</BODY>
</HTML>