您的位置:首页 > Web前端 > HTML

HTML中让表单input等文本框为只读不可编辑的方法

2016-03-05 12:45 801 查看
<input name="ly_qq" type="text" tabindex="2" onMouseOver="this.className='input_1'" onMouseOut="this.className='input_2'" value="123456789" disabled="true" readOnly="true" />

disabled="true" 此果文字会变成灰色,不可编辑。

readOnly="true" 文字不会变色,也是不可编辑的

Disabled说明该input无效,及其value不会传递给任何程序,比如asp、php等。

Readonly仅仅是无法编辑,不影响其值的传递。
Disabled使用:<INPUT type=”text” name=”username” value=”james”disabled>

Readonly使用:<INPUT type=”text” name=”partNumber” value=”1500″ readonly>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: