输入字段名称以数字开头 [英] Input field name starts with a number

查看:169
本文介绍了输入字段名称以数字开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名称为MD5字符串的输入字段,例如:

< input type =hiddenname =7815696ecbf1c96e6894b779456d330e现在我明白,将数字作为输入字段名称中的第一个字母通常是不好的做法,但有没有任何副作用,如某些浏览器不会发送POST请求?

解决方案

ID属性必须以HTML 4.01 W3C规范的字母开头,但是由于输入元素的NAME属性是CDATA类型的(

对NAME属性的一个真正限制是当您使用GET方法提交表单时,因为在这种情况下,表单数据必须限制为ASCII码(< a href =http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3 =noreferrer>来源)。


I have an input field whose name is an MD5 string e.g.:

<input type="hidden" name="7815696ecbf1c96e6894b779456d330e" value="1">

Now I understand that having a number as the first letter in an input field name is generally bad practice, but are there any side-effects to this such as a certain browser won't send it in the POST request?

解决方案

An ID attribute would have had to begin with a letter as per the HTML 4.01 W3C specification, however since the NAME attribute of input elements is of CDATA type (Source), this restriction does not apply.

One real restriction you get on NAME attributes is when you submit a form with the GET method, because in this case, form data must be restricted to ASCII codes (Source).

这篇关于输入字段名称以数字开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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