来自<A>的POST标签 [英] POST from an <A> tag

查看:28
本文介绍了来自<A>的POST标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以仅通过 <a> 标签进行 POST?我知道锚标签通常只用于 GET,而且我知道我可以使用 javascript 来做到这一点(例如 JavaScript post 请求就像表单提交) 但对我来说这似乎有点混乱.有没有办法用直接的 HTML 来做到这一点?

Is it possible to do a POST from just an <a> tag? I know anchor tags are usually just for GETs, and I know I can use javascript to do this (like in JavaScript post request like a form submit) but to me that seems a little messy. Is there a way to do this with straight HTML?

推荐答案

仅使用 HTML 无法POST a 元素.

There is no way to POST an a element using only HTML.

从这个 DTD 片段可以看出(HTML 4.01 规范):

As can be seen from this DTD fragment (HTML 4.01 spec):

<!ELEMENT A - - (%inline;)* -(A)       -- anchor -->
<!ATTLIST A
  %attrs;                              -- %coreattrs, %i18n, %events --
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #IMPLIED  -- advisory content type --
  name        CDATA          #IMPLIED  -- named link end --
  href        %URI;          #IMPLIED  -- URI for linked resource --
  hreflang    %LanguageCode; #IMPLIED  -- language code --
  rel         %LinkTypes;    #IMPLIED  -- forward link types --
  rev         %LinkTypes;    #IMPLIED  -- reverse link types --
  accesskey   %Character;    #IMPLIED  -- accessibility key character --
  shape       %Shape;        rect      -- for use with client-side image maps --
  coords      %Coords;       #IMPLIED  -- for use with client-side image maps --
  tabindex    NUMBER         #IMPLIED  -- position in tabbing order --
  onfocus     %Script;       #IMPLIED  -- the element got the focus --
  onblur      %Script;       #IMPLIED  -- the element lost the focus --
  >

没有属性可以控制是将 POST 还是 GETa 元素一起使用.

There is no attribute that controls whether to use POST or GET with an a element.

如果你想滥用语义,你必须编写它的脚本.

You have to script it, if you want to abuse the semantics.

这篇关于来自&lt;A&gt;的POST标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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