readonly =“true”与“true”之间的区别是什么? &安培;只读= QUOT;只读&QUOT ;? [英] What is the difference between readonly="true" & readonly="readonly"?

查看:243
本文介绍了readonly =“true”与“true”之间的区别是什么? &安培;只读= QUOT;只读&QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么区别:

 < input name =TextBox1type =textid =TextBox1 readonly =true/> 



 < input name =TextBox1type =textid =TextBox1readonly =readonly/> 

当我将 readonly 设置为 true 它与 readonly ='readonly'有些不同。 W3C标准规定 readonly 应该是'readonly'&不是'true'。为什么大多数浏览器允许 readonly ='true',这与 readonly ='readonly'

解决方案

赋予元素属性 readonly 将为该元素指定只读状态。无论你在后面放置什么值或者如果你在后面放置任何值都没有关系,它仍然会将其视为只读。放置 readonly =false将无法正常工作。 建议使用W3C标准。

>

What is the difference between:

<input name="TextBox1" type="text" id="TextBox1" readonly="true" />

and:

<input name="TextBox1" type="text" id="TextBox1" readonly="readonly" />

When i set readonly to true it works somewhat different from readonly='readonly'. W3C standard says readonly should be 'readonly' & not 'true'. Why most of the browsers allow readonly='true' which has somewhat different functionality than readonly='readonly'?

解决方案

Giving an element the attribute readonly will give that element the readonly status. It doesn't matter what value you put after it or if you put any value after it, it will still see it as readonly. Putting readonly="false" won't work.

Suggested is to use the W3C standard.

这篇关于readonly =“true”与“true”之间的区别是什么? &安培;只读= QUOT;只读&QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆