[Javascript] readonly in IE7

Anthony Ettinger anthony at chovy.com
Sun Sep 2 04:36:14 CDT 2007


On 9/1/07, John Pillion <john at conv-dg.com> wrote:
>
> k, I have another question.  I'm trying to mark a text box as readonly
> (from a 'yes/no' radio pair, where disabledValue is the value from the
> radio button - this part works fine). Below is the portion of code,
> which will not work in IE7 (possibly all versions of IE?).
>
>
>     var txtBox = document.forms["bldForm"].elements["bldName"];
>
>     if (disabledValue.toLowerCase() == "y"){
>         txtBox.setAttribute('readonly','readonly');
>     }else{
>         txtBox.removeAttribute('readonly');
>     }
>
>
>
> I saw elsewhere that the following sometimes is more reliable for IE to
> do the following:
>
>     txtBox.setAttribute('readonly','');
>     txtBox.readonly = 'readonly';
>
> this does not work either though, nor does
>
>     txtBox.readonly = 'readonly';



try txtBox.disabled = 'disabled';


-- 
Anthony Ettinger
Ph: 408-656-2473
var (bonita, farley) = new Dog;
farley.barks("very loud");
bonita.barks("at strangers");

http://chovy.dyndns.org/resume.html
http://utuxia.com/consulting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070902/752b2fd6/attachment.htm>


More information about the Javascript mailing list