如何从没有JS的链接进行HTTP POST [英] How to HTTP POST from a link without JS

查看:120
本文介绍了如何从没有JS的链接进行HTTP POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果禁用JS,任何方法都可以从链接提交POST请求? b
$ b

使用<输入

使用<输入使用< a href =''onclick ='form.submit()'>类型='提交>',但我需要链接而不是按钮。但依赖于JS
  • 使用< input type ='image'> ...再次..不是真正的链接

  • 我需要一个没有JS的浏览器的回退方法,我的这些按钮区域对于按钮或图像来说太小

    解决方案

    如果你想使用CSS,你可以让按钮看起来像普通链接?



    可能是这样的吗?

     < style type =text / cssmedia =screen> 
    input {
    border:none;
    背景:无;
    颜色:#00f;
    text-decoration:下划线;
    光标:指针;
    display:inline;
    保证金:0;
    padding:0;
    }
    < / style>

    点击< input type =submitvalue =here/> ;!

    编辑以添加:以下CSS只是 的一个例子>工作,尽管没有经过严格测试,并且看起来像是您可能需要稍微调整的正常链接之一。


    Any methods to submit a POST request from a link if JS is disabled?

    Ideeas so far (none of them perfect)

    1. Use <input type='submit>, but I need a link not a button
    2. Use <a href='' onclick='form.submit()' > but that relies on JS
    3. Use <input type='image'> ... again .. not really a link

    I need a fallback method for browsers without JS, and my area for these "buttons" is too small for buttons or images

    解决方案

    You could make the button look like a normal link if you want using CSS?

    Something like this perhaps?

    <style type="text/css" media="screen">
    input {
      border: none;
      background: none;
      color: #00f;
      text-decoration: underline;
      cursor: pointer;
      display: inline;
      margin: 0;
      padding: 0;
    }
    </style>
    
    Click <input type="submit" value="here"/>!
    

    Edit to add: The following CSS is just an example of how it might work, though not thorougly tested and to make it look like one of your normal links you might need to tweak it a bit.

    这篇关于如何从没有JS的链接进行HTTP POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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