473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
1 11293


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
0
by: **Developer** | last post by:
I have a RichTextBox and I want to programmatically change the Insert/Overwrite mode. I tried the following but it doesn't appear to change the mode. Pressing the Insert or Ins key does change...
2
by: Playmaker | last post by:
Hopefully someone else has come across this issue. What I have is a SQL Server 2000 back-end. I've created a simple webform which has both Gridview and DataList controls on it populated with a...
0
by: clickon | last post by:
I want to use an INSERT Query as the value for the UpdateCommand property of an SQL datasource, anyone know if this will actually work ? The reason i want to do it is bacause i am taking values...
1
by: J055 | last post by:
Hi I'd like to do the following with the FormView/ObjectDataSource but not sure of the best approach. 1. Change the FormView mode to Edit if a valid QueryString ID exists or Insert mode if it...
5
by: Brad Baker | last post by:
I'm trying to write a simple asp.net page which updates some data in a SQL database. At the top of the page I have the following code: <%@ Page Language="C#" Debug="true" %> <%@ import...
1
by: Chris | last post by:
I have a treeview control, which I use to select a row in a table which will be used to populate a formview. Depending on what node is selected in the treeview I want the formview to be either in...
2
by: shapper | last post by:
Hello, I am working with a ListView but I suppose that with a GridView might be the same. Instead of having an Insert Button on each GridView row I would like to have only one Insert button,...
0
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.