当前位置:

HTML中的target属性之framename 伪ajax 解决请求支付猫付款码跳转新页面问题

本文最后更新于2019-11-08,已超过 1年没有更新,如果文章内容、图片或者下载资源失效,请留言反馈,我会及时处理,谢谢!

温馨提示:本文共1398个字,读完预计4分钟。

包含target属性的标签有:<a> <form> <base> <area>。

对应的target值有:

_blank

_parent

_self

_top

framename (<area>标签没有)

对于前四个来说,大家都再熟悉不过了。但是很少有人注意到或者说使用到第五个值:framename。因为它设计得实在是太巧妙了

这里我给出一个替代异步的ajax调第三方支付不跳转页面的例子。

一个form,对应的target:

<form style='display:none;' id='formpay' name='formpay' method='post' target="hidden_iframe"  action='http://pay.ebkf.net'>
            <input name='goodsname' id='goodsname' type='text' value='' />
            <input name='istype' id='istype' type='text' value='' />
            <input name='key' id='key' type='text' value=''/>
            <input name='notify_url' id='notify_url' type='text' value=''/>
            <input name='orderid' id='orderid' type='text' value=''/>
            <input name='orderuid' id='orderuid' type='text' value=''/>
            <input name='price' id='price' type='text' value=''/>
            <input name='return_url' id='return_url' type='text' value=''/>
            <input name='uid' id='uid' type='text' value=''/>
            <input type='submit' id='submitdemo1'>
</form>

一个iframe,对应的name
<iframe style="" id="ifqr" frameborder="0"  scrolling="yes" name="hidden_iframe"></iframe>    

这样,当你调起支付时,表单将在下面的这个iframe里显示请求的支付页面而不会跳转新页面。

本文链接:,转发请注明来源!
评论已关闭。