一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

提交頁面的定位--scrollIntoView的用法

提交頁面定位問題一直騷擾我,比如我們在DataGrid外面加了來使DataGrid在一定區域內呈現,這樣如果把滾動條拉到底部的時候點擊修改(或者修改后點擊更新,取消)頁面重新加載的時候都會把滾動條拉到頁面最上面部分 ,特此我將下面知識共享一下:
object.scrollIntoView( [bAlignToTop])

Parameters

bAlignToTopOptional. Boolean that specifies one of the following values:
trueDefault. Scrolls the object so that top of the object is visible at the top of the window.
falseScrolls 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.

HideExample

  var coll = document.all.tags("P");if (coll.length >= 5){coll(4).style.textDecoration = "underline";coll(4).scrollIntoView(true);}

Standards Information

There is no public standard that applies to this method.

Applies To

INPUT type=ra...
PlatformVersion
Win16:4.0
Win32:4.0
Windows CE:4.0
Unix:4.0
Mac:4.0
A, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, controlRange, CUSTOM, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, NOBR, OBJECT, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TextRange, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, WBR, XMP
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms.

二、在.NET中的應用
1、定位指定控件
/// <summary>
  /// 定位txtCode控件
  /// </summary>
  private void Scroll()
  {
   string s="<script>function window.onload(){document.all('"+this.txtCode.ClientID+"').scrollIntoView();}</script>";
   Page.RegisterStartupScript("",s);
  }

2、定位指定DataGrid列
  <div style="BORDER:0px;PADDING:0px;MARGIN:0px;OVERFLOW:scroll;WIDTH:600px;HEIGHT:200px" align="center">
現在給出一種簡單的辦法(其他的一些利用錨點等辦法都比較復雜)
private void Scroll(int index)
        
{
            
string s="<script>function window.onload(){document.all('"+this.DataGrid1.ClientID+"').rows["+index+"].scrollIntoView();}</script>";
            Page.RegisterStartupScript(
"",s);
        }

寫了一個方法,其中DataGrid1換成自己的DataGrid的ID,這個方法傳遞進去的參數就是行號,也就是e.Item.ItemIndex。
比如在編輯操作的時候會寫this.DataGrid1.EditItemIndex=e.Item.ItemIndex;
在此語句的以前加入Scroll(e.Item.ItemIndex);就可以了
同樣在更新操作的時候寫為Scroll(e.Item.ItemIndex);this.DataGrid1.EditItemIndex=-1;綁定;

AspNet技術提交頁面的定位--scrollIntoView的用法,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 成人国产精品视频 | 久久五月激情婷婷日韩 | 狠狠色噜噜狠狠狠狠米奇7777 | 欧美一区二区三区激情啪啪 | 久久久久久久成人午夜精品福利 | 成人a毛片| 人人干在线视频 | 亚洲第一成人在线 | 国产精品成人第一区 | 天天干天天色综合网 | 在线观看免费午夜大片 | 国产网红在线观看 | 国产免费91视频 | 国产精品亚洲欧美一区麻豆 | 国产欧美激情一区二区三区-老狼 | 日本一区二区三区免费看 | 五月婷婷婷婷 | 久久福利一区 | 日韩三级一区二区 | 色婷婷综合久久久久中文一区二区 | 91久久香蕉国产线看 | 国产真实伦实例 | 美女的胸又黄又www网站免费 | 日本不卡一区二区三区在线观看 | 四虎永久免费地址在线观看 | 激情文学综合 | 中文字幕综合久久久久 | 2021精品国产品免费观看 | 伊人久久中文字幕 | 婷婷激情丁香 | 日本午夜vr影院新入口 | 色婷婷综合久久久久中文 | 亚洲香蕉影院 | 欧美人与禽交片在线播放 | 久久精品免视看国产成人2021 | 亚州视频一区二区 | 亚洲图片欧美小说 | 久艾草国产成人综合在线视频 | 一区二区视频 | 伊香蕉大综综综合久久 | 黄视频网站观看 |