W3C home > Mailing lists > Public > www-talk@w3.org > March to April 2001

Re: Making a HTML text field readonly

From: Clover Andrew <aclover@1value.com>
Date: Tue, 13 Mar 2001 10:55:00 +0100
Message-ID: <D58B0195B58937489E89124469E57CA20D4FA2@EX1.1value.com>
To: <www-talk@w3.org>
Mukul Gandhi <mukulw3@yahoo.com> wrote:

> I want to make a HTML text field read only.
> But it works in IE 5 and not in Netscape 4.51.

You can't do it with HTML in NN4, but there are some
JavaScript hacks. By tradition, onfocus="this.blur();",
but this makes keyboard navigation difficult. Alternatives
include onchange/onsubmit events to set the content back
to what it was, and timeouts to do same.

If possible it's best to avoid the problem by not using
form elements for immutable content, or not caring if
they are changed. I don't know what your situation is
though.

-- 
Andrew Clover
Technical Consultant
1VALUE.com AG
Received on Tuesday, 13 March 2001 05:03:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:25 GMT