简体   繁体   English

如何在this.form.submit()之后留在相同的页面位置?

[英]how to stay at the same page location after this.form.submit()?

After I perform this.form.submit() onchange event it reloads the page and brings to the very top of the page. 在执行this.form.submit()onchange事件后,它会重新加载页面并显示在页面的顶部。 Is there a possible solution to be brought to the same page location I was before the js onchange call ? 是否有可能将解决方案带到与js onchange调用之前相同的页面位置?

You can make an ajax call so that the page is not entirely reloaded (nor scrolled back). 您可以进行ajax调用,以使页面不会完全重新加载(也不会向后滚动)。

Or you can use anchors to scroll to a specific div . 或者,您可以使用锚点滚动到特定的div To do so append #theIdOfTheDiv at the end of the redirection URL. 为此,在重定向URL的末尾附加#theIdOfTheDiv

请使用AJAX以便不重新加载页面,或者将表单中的操作URL更改为使用命名锚点( #something ),以便将其重新加载到页面上的相应锚点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM