question about readonly property

D

datactrl

HI, all
I found the return value from obj.readOnly is always the original vaule in
HTML setting, even after doing obj.readOnly=true/false. How can I get the
real time value set by javascript?

jack
 
L

Lee

datactrl said:
HI, all
I found the return value from obj.readOnly is always the original vaule in
HTML setting, even after doing obj.readOnly=true/false. How can I get the
real time value set by javascript?

The new value is submitted regardless of the readonly setting.
What makes you think that it isn't?
If you're submitting to the same page, you won't see the new
value in the form field.
 
D

datactrl

For example ...

<TD>
<INPUT TYPE="text" id="itemdesc" READONLY class=scFieldRecList
name="page1"></TD>
<TD>
.....
itemdesc.readOnly=false;
alert(itemdesc.readOnly);
.....
I mean the alert always show "true" rather than "false".

Jack
 
L

Lee

datactrl said:
For example ...

<TD>
<INPUT TYPE="text" id="itemdesc" READONLY class=scFieldRecList
name="page1"></TD>
<TD>
....
itemdesc.readOnly=false;
alert(itemdesc.readOnly);
....
I mean the alert always show "true" rather than "false".

This alerts false in Netscape 7.1 and IE 6:

<html>
<body>
<form>
<INPUT TYPE="text"
id="itemdesc"
READONLY
class=scFieldRecList
value="initial value"
name="page1">
</form>
<script>
document.getElementById("itemdesc").readOnly=false;
document.getElementById("itemdesc").value="new value";
alert(document.getElementById("itemdesc").readOnly);
</script>
</body>
</html>
 
D

datactrl

Thank's Lee
Yes, it should be exactly as what you show on your sample. I ve got to
check my program. My example is just a short cut from my real one. Thank you
very much!

Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top