jo********@yahoo.com wrote:
By default, when I type into a text box, it inserts the text into the
existing text rather than overwriting the existing text. If I hit the
"insert" key on my keyboard, it switches the mode to over-writing the
text in the box. But when I refresh the page, it returns to inserting
the text. I want my text boxes to be in the overwrite mode by default.
Is there a way to do this in html or javascript. The solution only
needs to work for IE.
For IE Windows it seems to work to call
document.execCommand('OverWrite', false, true)
to enable overwrite mode for text controls on the page and
document.execCommand('OverWrite', false, false)
to switch it off.
execCommand and its command strings (e.g. 'OverWrite') are documented on
http://msdn.microsoft.com/.
With IE 5.5 and IE 6 you can have editable HTML controls too (e.g. with
<div contenteditable="true">
I have not tested but I expect calling
document.execCommand('OverWrite', false, true)
will switch on overwrite mode for those editable areas too so be careful
on when/where you call the command.
--
Martin Honnen
http://JavaScript.FAQTs.com/