【问题标题】:Watermark Problem with Internet ExplorerInternet Explorer 水印问题
【发布时间】:2011-09-07 22:45:25
【问题描述】:

在我的模型中我有

[Display(Prompt="Author First Name",Name="First Name")]
[StringLength(100,ErrorMessage="First Name may not be longer than 100 characters")]
public string AuthFirstName { get; set; }

我有一个 String.cshtml 文件

@Html.TextBox("",ViewData.TemplateInfo.FormattedModelValue, new { @class="text-box single-line", placeholder = ViewData.ModelMetadata.Watermark })

在 Firefox 和 chrome 中,当我的表单显示时,它每次都正确显示水印。 出于某种原因,我无法让它们显示在 Internet Explorer 中,不幸的是,我的大多数用户群都将使用这个浏览器。我确实安装了 chrome 框架,安装后我在 IE 中获得了水印,但这对于我的许多非技术用户来说可能不是最理想的解决方案。

提前致谢!

【问题讨论】:

    标签: c# internet-explorer asp.net-mvc-3


    【解决方案1】:

    仅计划在 IE10 中支持占位符。
    http://caniuse.com/#search=placeholder

    您可以做的是使用 JavaScript 检测浏览器对占位符的原生支持,如果不支持,则回退到 JavaScript 实现。

    这是一个使用 Modernizr 进行支持检测和一个用于占位符实现的 jQuery 插件的示例:http://plugins.jquery.com/project/HTML5izerPlaceholder

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-10
      • 1970-01-01
      • 2011-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多