By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

How can I change the insert/typeover mode of a text box?

P: n/a
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.
Thanks in advance.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


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/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.