怎样使input中的内容为只读,也就是说不让用户更改里面的内容。 <input type="text" name="input1" value="中国" /> <input type="text" name="input1" value="中国" readonly /> <input type="text" name="input1" value="中国" disabled /> 最好不要用disabled,不然就无法取出里面的值了. <input type="text" name="input1" value="中国" readonly="true" /> <input type="text" name="input1" value="中国" readonly /> 区别: 1.disabled -- 完全不可编辑,并且是不能复制的。 2.readonly -- 不可编辑,但是是可以复制。 3.Readonly只针对input(text / password)和textarea有效,而disabled对于所有的表单元素都有效,包括select, radio, checkbox, button等。 4.表单元素在使用了disabled后,当我们将表单以POST或GET的方式提交的话,这个元素的值不会被传递出去,而readonly会将该值传递出去 同点: 使input不可编辑。
热门文章更多>>
标签更多>>
专题更多>>
最新文章更多>>
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
- 使用 C# 6.0 功能运行 TFS 构建
小鹿姐_