是否有可能无法跳转到表单提交页面的顶部? [英] Is it possible not to jump to the top of the page on form submit?

查看:93
本文介绍了是否有可能无法跳转到表单提交页面的顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


FIXED,包裹输入标签并在其周围有一个锚标签,似乎
已经有效。


这个问题听起来有点令人困惑,让我详细说明。

我用PHP制作了一个邮件表单。这种形式一直在页面的底部。
当我点击send(这是一个输入标签)时,如果有错误,它会在窗体上方显示它们。

但是当你点击发送该页面将首先返回顶部,并且必须一直向下滚动,以查看是否有任何错误。



因此,可以保留页面从跳回来的开始?

解决方案

您可以在窗体上有一个页面定位点并指向该定位点,像这样的东西应该为你做。

 < form action =someformaction.php#form-anchorid = 形锚> 
< / form>

现在当表单被提交时,它应该将页面向下移动到锚点的位置。


FIXED, Wrapping the input tag with an anchor tag around it seemed to have worked.

The question could sound a bit confusing, let me elaborate.

I have made a mail form with PHP. This form is all the way at the bottom of the page. When I click send (this is an input tag), if there are errors, it will display them above the form.

But when you click on send the page will first go back to the top and you have to scroll all the way down to see if you have made any errors.

So is it possible to keep the page from jumping back the the start?

解决方案

You could have a page anchor on the form and point at that anchor in the form action, something like this should do that for you.

<form  action="someformaction.php#form-anchor" id="form-anchor">
</form>

Now when the form is submitted it should move the page down to where that anchor is.

这篇关于是否有可能无法跳转到表单提交页面的顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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