[Note Series] text box readonly attribute encountered in Struts development

xiaoxiao2021-03-06  72

The TextField written in the program is as follows:

In order to call this name in JavaScript, it gives it an individual name (StyleId = "Shry").

Now you have to click on a button, change this component's readOrthly value into false in the JavaScript function. First try to use Document.Forms [0] .shry.readonly = false This statement directly assigns readOnly to false, so that it can be implemented, and the results are not reacted. Later, I use Alert (Document.Forms [0] .shry.readonly) to print this property, display Undefined, indicating that JavaScript can't find this attribute. Later, I found a method getElementById (), so use Document.GtelementByid ("shry"). Readonly = false; to assign it to it, the problem is solved! !

By Willpower 2004.8.28

转载请注明原文地址:https://www.9cbs.com/read-122559.html

New Post(0)