?
快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

单机长沙麻将:齐赢会娱乐:保持页面中滚动条的位置,使得页面提交后滚动条还是在原来的位置

?

长沙转转麻将必胜口诀 www.fv7j.com.cn 一样平常来说很多的人在节制浏览器滚动条都是用Page.SmartNavigation = False,对付页面中DIV等等的滚动条节制,我在看了别人代码后,写了一个,仅供参考:

Public Shared Sub SaveDivScrollPosition(ByVal divIDArray As String, ByVal objPage As Page)

Dim saveScrollPosition As String

Dim i As Int齐赢会娱乐eger

Dim divID() As String

divID = divIDArray.Split(",")

For i = 0 To divID.Length - 1

objPage.RegisterHiddenField(divID(i) & "__SCROLLPOS", objPage.Request.Form(divID(i) & "__SCROLLPOS"))

saveScrollPosition = ""

objPage.RegisterStartupScript("saveScroll" & divID(i), saveScrollPosition)齐赢会娱乐

Next

End Sub

Public Shared Sub RestoreDivScrollPosition(ByVal divIDArray As String, ByVal objPage As Page)

Dim restoreScrollPosition As String

Dim setPositionFunction As String

Dim i As Integer

Dim divID() As String

divID = divIDArray.Split(",")

For i = 0 To divID.Length - 1

setPositionFunction = setPositionFunction & "SetScrollPosition('" & divID(i) & "');"

Next

restoreScrollPosition = ""

objPa齐赢会娱乐ge.RegisterStartupScript("restoreScroll", restoreScrollPosition)

End Sub

JAVASCRIPT:

function SetScrollPosition(divID){

var e;

var a;

var obj;

if (document.getElementById(divID)){

obj = eval('document.齐赢会娱乐forms[0].' + divID + '__SCROLLPOS');

if (obj) {

e=eval('document.forms[0].' + divID + '__SCROLLPOS').value;

a=e.split(',');

document.getElementById(divID).scrollTop= a[0];

document.getElementById(divID).scrollLeft= a[1];

}

}

}

在页面后台调用的时刻,写下如下的代码:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 齐赢会娱乐Handles MyBase.Load

call SaveDivScrollPosition("div1,div2,div3",me)

call RestoreDivScrollPosition("div1,div2,div3",me)

End Sub

欠美意思,这两个SUB可以写成一个,仅供参考。

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: