473,394 Members | 1,841 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,394 software developers and data experts.

Problem removing readOnly in IE

I am having trouble with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<input value='test' type='text' readonly='readonly'
onfocus='this.readOnly = false;'
onblur='this.readOnly = true;'></input>
</body>
</html>

In FF, this works as I would expect. When clicking on the input, the readOnly
property is set to false and the focus is given to the element, with the
cursor placed after the last character.

In IE, the readOnly property is set to false, but the element isn't actually
given focus. Instead, I have to click on the input a second time in order to
actually input text with the keyboard.

Is there a way to make this work the same in IE as it does in FF? I have
tried things like calling this.focus() and this.click() after setting
readOnly to false, but they have no effect.

Any help would be greatly appreciated.

Thank you,

- J.
Dec 1 '06 #1
2 5434
J. McConnell wrote:
I am having trouble with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<input value='test' type='text' readonly='readonly'
Hi,

Maybe you confused IE because you set the value to 'readonly' instead of the
expected boolean true or false.

And maybe onMouseOver with onMouseOut works better. Giving focus to a
readonly-element possibly made little sense to the IE developers.

Give that a shot.

Regards,
Erwin Moller
onfocus='this.readOnly = false;'
onblur='this.readOnly = true;'></input>
</body>
</html>

In FF, this works as I would expect. When clicking on the input, the
readOnly property is set to false and the focus is given to the element,
with the cursor placed after the last character.

In IE, the readOnly property is set to false, but the element isn't
actually
given focus. Instead, I have to click on the input a second time in order
to actually input text with the keyboard.

Is there a way to make this work the same in IE as it does in FF? I have
tried things like calling this.focus() and this.click() after setting
readOnly to false, but they have no effect.

Any help would be greatly appreciated.

Thank you,

- J.
Dec 1 '06 #2
On 2006-12-01, Erwin Moller
J. McConnell wrote:
>I am having trouble with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<input value='test' type='text' readonly='readonly'

Maybe you confused IE because you set the value to 'readonly' instead of the
expected boolean true or false.
I gave this a shot, setting the value to true or false, and it didn't
make a difference. Anyway, "readonly" is the only valid value in XHTML.
And maybe onMouseOver with onMouseOut works better. Giving focus to a
readonly-element possibly made little sense to the IE developers.
Actually, onMouseOver and onMouseOut did work. Unfortunately, it
doesn't do me any good because you can't tab into the control. Also, I
recently read that one difference between readonly and disabled is that
readonly elements can receive focus while disabled elements can't.

I do agree that this is an edge case and arguably not the best way to go
about this, but do to circumstances beyond my control it would be
difficult to go another route, like never setting the element to
readonly in the first place.

Thanks for the suggestions,

- J.
Dec 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Thomas | last post by:
Hi, I'm having a problem with the dynamically created inputfields in Internet Explorer. The situation is the following: - I have a dynamically created table with a textbox in each Cell. - It...
6
by: Cristian Suazo | last post by:
Hi, I deployed my application but got a strange error when doing the deployment using the xcopy method. A strange thing is that when I try to do the same steps on another machine that has the...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
0
by: Adam J. Schaff | last post by:
Hello. I have a custom collection that implements IBindingList (allownew and allowremove are both true). I have bound it to a datagrid. I have add and remove buttons on the screen. I want to...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
3
by: Joe | last post by:
Hi, I am creating a sudoku on VB Dot Net but to set all textboxes to its standard I have this code below. I want to set this in an array but I don't know how to work with arrays. Could someone...
1
by: Manuela Abele | last post by:
Hello everybody, I have a problem with interface and I need urgent your help. public interface IKoerper { // Properties int laenge { get; } int breite { get; } int hoehe { get; }
9
by: kimbred | last post by:
I have a gridview that has a hyperlink column. It gets the web address from a data source. This is all working as it should. The problem is when I click the web address, it doesn't go to the...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.