Here is how I create the textbox:
box = document.createElement("input");
Here is how I change the text:
box.setAttribute('value',myString);
However, each text-box becomes permanently unresponsive to the above code does after I edit it (in firefox, even clicking on it causes this).
Also, I would like to prevent the user form editing the value sometimes:
box.setAttribute('readonly','true');
But this also causes the boxes to lock permanently from the program trying to edit them; box.setAttribute('readonly','false') doesn't undo the lock.
要删除只读属性,必须使用box.removeAttribute('readonly');
You should use box.value = myString
and box.readOnly = false
. Node attributes are always strings and if you want to remove one you need to use element.removeAttribute('atribute_name')
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.