在不禁用PHP的情况下,通过提交按钮禁用滚动?

问题描述 投票:0回答:1

我希望在单击提交表单中的提交按钮时禁用滚动,同时我仍然希望获得与按钮工作相关的PHP的电子邮件转发功能。

我阅读了本文并验证了使用preventDefault()会禁用提交按钮的默认行为以及与该按钮关联的PHP代码:

How do i stop a page from scrolling to the top when button clicked in php?

请有人告诉我如何实现这两个目标。

php email button submit forwarding
1个回答
0
投票

首先,您只需添加一个类似的功能

form.onsubmit = function()
{
   // disable scroll code, see link below
};

这里有一个很好的答案如何禁用鼠标滚动和其他键:

How to disable scrolling temporarily?

© www.soinside.com 2019 - 2024. All rights reserved.