jjzjj

lastFocusedControlId

全部标签

javascript - 如何防止 Focus() 方法将页面滚动到顶部

我在gridview中设置了一组文本框,我使用Focus()方法在失去预期的文本框后恢复焦点。问题是:页面(可滚动),当我调用Focus方法时,在文本更改事件中,页面跳转到顶部。这是一种令人困惑的行为。我的问题是:有什么方法可以防止Focus()方法跳转到页面顶部吗?我的代码:protectedvoidtxt_evaluateWeights_TextChanged(objectsender,EventArgse){calc();intindex=((System.Web.UI.WebControls.GridViewRow)(((RadTextBox)sender).Parent.Na