设置焦点时 ASP.NET 嵌套控件滚动
我在母版页中有一个嵌套控件。当我明确地将焦点设置在此控件上的第一个文本框上时,页面会向上移动到第一个文本框。有没有办法防止页面跳转但仍设置焦点,以便用户不必单击文本框?我希望他们能够在页面显示时立即开始输入。
I have a nested control within a master page. When I explicitly set the focus on the first textbox on this control, the page shifts up to this first textbox. Is there a way to prevent the page from jumping up but still set the focus so the user doesn't have to click into the textbox? I want them to be able to start typing right when the page displays.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是一个浏览器设置,因为它自动工作:
http://jsfiddle.net/KjCuM/
可以进行修复,然后滚动回页面顶部,但我认为如果焦点位于控件上,则在屏幕上可见该控件是有意义的。否则用户将无法看到他们提交的内容。
I think this is a browser setting, as it works automatic:
http://jsfiddle.net/KjCuM/
You could put a fix in place to then scroll back to the top of the page perhaps, but I think it makes sense for the control to be viewable on the screen if there is focus on it. Otherwise the user will not be able to see what they are submitting.