如何在javascript中使用readOnly。 [英] How to use readOnly in javascript.
本文介绍了如何在javascript中使用readOnly。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个名字,中间名和姓氏的文本框....我想让中间名只读,除非你没有在文本框中输入第一个名字。 PLZ任何人都可以帮我解决??????
i have 3 textbox for first name, middle name and last name.... i want to make middle name readonly unless one doesn't input the 1st name in the text box. plz can anyone help me out??????
推荐答案
你可以操作属性readonly
。请参阅:
http://www.w3schools.com/tags/tag_input.asp [ ^ ],
http://www.w3schools.com/tags/att_input_readonly.asp [ ^ ]。
例如:
You can manipulate the attributereadonly
. Please see:
http://www.w3schools.com/tags/tag_input.asp[^],
http://www.w3schools.com/tags/att_input_readonly.asp[^].
For example:
document.getElementById("yourElementId").readOnly = true;
我强烈推荐使用jQuery:
http://forums.asp.net/t/1702179.aspx?How+to+set+readonly+textbox+via+js+jquery [< a href =http://forums.a sp.net/t/1702179.aspx?How+to+set+readonly+textbox+via+js+jquerytarget =_ blanktitle =New Window> ^ ],
例如: http:// forums。 asp.net/t/1702179.aspx?How+to+set+readonly+textbox+via+js+jquery [ ^ ]。
这篇关于如何在javascript中使用readOnly。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文