输入字段名称以数字开头

编程入门 行业动态 更新时间:2024-10-25 12:20:19
本文介绍了输入字段名称以数字开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

解决方案

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

对NAME属性的一个真正限制是当您使用GET方法提交表单时,因为在这种情况下,表单数据必须限制为ASCII码(来源)。

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).

更多推荐

输入字段名称以数字开头

本文发布于:2023-11-06 05:25:26,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   开头   名称   数字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!