Re: Next form element
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Next form element

From: BootNic <Bootnic@bounce.prodigy.net>
Date: Tue Jan 31 2006 - 18:53:59 CET

> "Evertjan." <exjxw.hannivoort@interxnl.net> wrote:
> news:Xns975BB9063FBB7eejj99@194.109.133.242....
>
> Christoph wrote on 30 jan 2006 in comp.lang.javascript:
>
>> I know I can do
>> this by setting the form element to 'readonly' but that's not
>> possible as I'll need to modify that value elsewhere in my JS.
>
> 1 you can write the value of a readonly <input> element with
> javascript
>
> 2 you cannot change the readonlyness of an <input> element with
> javascript

I thought one could toggle readOnly between true and false.

What would the situation be that this does not work in?

> 3 however, you can use "disabled" to your advantage.
>
> <input id=x disabled>

<button type="button" onclick="x.readOnly=(x.readOnly)?false:true;
x.focus(); x.select();">toggle readOnly</button>

> <script type="text/javascript">
> var x = document.getElementById('x')
> x.value = 'hi world'
> alert(x.disabled)
> x.disabled = false
> </script>
>
> Do not mess with focus() to restrain the user!

-- 
BootNic   Tuesday, January 31, 2006 12:53 PM
Inform all the troops that communications have completely broken down.
*Ashleigh Brilliant*
Received on Tue Feb 7 21:29:00 2006