Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<input type="number" runat="server" id="numberonly"/> or <input type="tel" runat="server" id="numberonly"/>
将无法工作,因为它在 aspx wepform 服务器上运行,因此解析器错误即将到来。我们不能在 ASPX wepform 应用程序中使用 html5 类型属性?有没有办法使用任何插件或javascript在页面加载时设置类型属性?单击文本框时,我只想打开数字键盘。
我们可以这样使用,我在某个地方找到了它。
function setTypeNumeric() { document.getElementById('<%=myTextbox .ClientID%>').type = 'number'; }
在 ASPX 页面中,我们这样使用
<input id="myTextbox" runat="server" />
这将在文档就绪时设置类型属性。所以不会发生解析器错误。我们可以在 ASP.Net 页面控件中使用 HTML5 类型。它工作正常!!!