【问题标题】:Disable the scrolling by a submit button while NOT disabling PHP?在不禁用 PHP 的情况下禁用提交按钮的滚动?
【发布时间】:2019-02-18 04:38:11
【问题描述】:

我想在单击提交表单中的提交按钮时禁用滚动,同时我仍然希望与按钮相关联的 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】:

    首先你只需要添加一个类似

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

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

    How to disable scrolling temporarily?

    【讨论】:

      猜你喜欢
      • 2011-05-19
      • 2012-06-14
      • 1970-01-01
      • 2019-03-24
      • 2020-08-14
      • 2019-02-25
      • 1970-01-01
      • 2015-11-28
      相关资源
      最近更新 更多