提交页面的定位提交页面的定位–scrollIntoView的用法的用法
提交页面定位问题一直骚扰我,比如我们在DataGrid外面加了来使DataGrid在一定区域内呈现,这样如果把滚动条拉到底部的
时候点击修改(或者修改后点击更新,取消)页面重新加载的时候都会把滚动条拉到页面最上面部分 ,特此我将下面知识共
享一下:
object.scrollIntoView( [bAlignToTop])
Parameters
bAlignToTop
Optional. Boolean that specifies one of the following values:
true Default. Scrolls the object so that top of the object is visible at the top of the window.
false
Scrolls the object so that the bottom of the object is visible at the bottom of the
window.
Return Value
No return value.
Remarks
The scrollIntoView method is useful for immediately showing the user the result of some action without
requiring the user to manually scroll through the document to find the result.
Depending on the size of the given object and the current window, this method might not be able to put the item
at the very top or very bottom, but will position the object as close to the requested position as possible.
Example
This example uses the scrollIntoView method to underline the content of the document’s fifth paragraph and
scroll it into view at the top of the window.