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

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

问题描述

是否可以从< a> 标签执行POST?我知道锚标签通常只是为GETs,我知道我可以使用JavaScript来做到这一点(如 JavaScript post request like a form submit ),但对我来说似乎有点混乱。有没有办法做到这一点直HTML?

解决方案

有没有办法 POST <

从这个DTD片段可以看出( a a a href =http://www.w3.org/TR/html401/struct/links.html#adef-href =noreferrer> HTML 4.01规范):

 <!ELEMENT A  -   - (%inline;)*  - (A) -  anchor  - > 
<!ATTLIST A
%attrs; - %coreattrs,%i18n,%events -
charset%Charset; #IMPLIED - 链接资源的字符编码 -
type%ContentType; #IMPLIED - 咨询内容类型 -
名称CDATA #IMPLIED - 指定链接结束 -
href%URI; #IMPLIED - 链接资源的URI -
hreflang%LanguageCode; #IMPLIED - 语言代码 -
rel%LinkTypes; #IMPLIED - 前向链接类型 -
rev%LinkTypes; #IMPLIED - 反向链接类型 -
accesskey%字符; #IMPLIED - 辅助键字符 -
形状%形状; rect - 用于客户端图像映射 -
coords%Coords; #IMPLIED - 用于客户端图像映射 -
tabindex NUMBER #IMPLIED - 按切换顺序的位置 -
onfocus%Script; #IMPLIED - 获得焦点的元素 -
onblur%Script; #IMPLIED - 元素失去焦点 -
>

没有属性控制是否使用 POST > 元素。



如果您想滥用语义,您必须来编写脚本。


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?

解决方案

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

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

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天全站免登陆