有两种方式可以实现input的只读效果:disabled 和 readonly。

自然两种出来的效果都是只能读取不能编辑,可是两者有很大不同。

Disabled说明该input无效,及其value不会传递给任何程序,比如asp、php等。
Readonly仅仅是无法编辑,不影响其值的传递。

Disabled使用:

<INPUT type=”text” name=”username” value=”james” disabled>


Readonly使用:

<INPUT type=”text” name=”partNumber” value=”1500″ readonly>

注:

1。IE下者表现一样,但FF下落不明readonly能聚集,但disabled不能,且有默认的背景色。

相关文章:

  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案