如何在帖子表单中跳转到< a name = ... [英] How to implement jump to <a name=... in post form

查看:152
本文介绍了如何在帖子表单中跳转到< a name = ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < form action =index.php 

我有很长的产品清单, method =post>
...
< / form>

我想跳转到产品通话行动,如:

 < a href =#prodid<?= $ id?>>跳转到产品< / a> 
...

< a name =prodid<?= $ id?>>< / a>

但我必须使用post方法。在get方法中,我会使用这个:

 < form action =index.php#prodid<?= $ id?> ;方法= GET > 
...
< / form>

如何操作?

使用< a name =...>< / a> 作为跳转标记在HTML5中被弃用为 a -element不再具有名称 - 属性。请参阅此处:带有'name'或'id'的HTML锚点?规范



您可以通过添加#[id] 来指定 id code>添加到URL中(或创建一个链接,如< a href =#[id]>跳转< / a> )。 >

添加hashtag与GET或POST没有任何关系。这只是一个浏览器功能。


I have long list of products and in each product i have form:

<form action="index.php" method="post">
    <input type="hidden" name="prodid" value="<?= $id ?>" />
    ...
</form>

I want to jump to product on call action like:

<a href="#prodid<?= $id ?>">jump to product</a>
...

<a name="prodid<?= $id ?>"></a>

but i must use post method. In get method I would use this:

<form action="index.php#prodid<?= $id ?>" method="get">
    ...
</form>

How to do it?

解决方案

Using <a name="..."></a> for a jump-mark is deprecated in HTML5 as the a-element has no name-attribute anymore. See here: HTML Anchors with 'name' or 'id'? and in the specs.

You can jump to anything on the site with a specified id-attribute by adding the #[id] to the URL (or creating a link like <a href="#[id]">jump</a>).

Adding the hashtag does not have anything to do with GET or POST. It's just a Browser-Feature.

这篇关于如何在帖子表单中跳转到&lt; a name = ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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