四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

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

提交頁面定位問題一直騷擾我,比如我們在DataGrid外面加了來使DataGrid在一定區(qū)域內(nèi)呈現(xiàn),這樣如果把滾動條拉到底部的時候點(diǎn)擊修改(或者修改后點(diǎn)擊更新,取消)頁面重新加載的時候都會把滾動條拉到頁面最上面部分 ,特此我將下面知識共享一下:
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中的應(yīng)用
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">
現(xiàn)在給出一種簡單的辦法(其他的一些利用錨點(diǎn)等辦法都比較復(fù)雜)
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,這個方法傳遞進(jìn)去的參數(shù)就是行號,也就是e.Item.ItemIndex。
比如在編輯操作的時候會寫this.DataGrid1.EditItemIndex=e.Item.ItemIndex;
在此語句的以前加入Scroll(e.Item.ItemIndex);就可以了
同樣在更新操作的時候?qū)憺镾croll(e.Item.ItemIndex);this.DataGrid1.EditItemIndex=-1;綁定;

AspNet技術(shù)提交頁面的定位--scrollIntoView的用法,轉(zhuǎn)載需保留來源!

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

主站蜘蛛池模板: 男男性恋免费视频网站| 香港论理| 免费观看淫www视频| 艳女十八式无删减版| s0hu搜狐| 爸爸好奇怪 电视剧| 成龙版杨家将电影免费播放| 妈妈的脊背简谱| 美女撒尿私密视频| 百字明咒标准读诵慢念| 日韩女同性恋| 电视剧暗夜与黎明剧情介绍| 贤惠好儿媳在线观看完整版| 佐格| xxxxxxxxxxxxxxxxxxxxxxxxx| 《遇见你之后》电影在线观看| 大红狗| 爱你电视剧演员表| 酒图片| 电影善良的妻子| 吃屎视频搞笑视频| 在线观看www视频| 好看女生头像| 无内秘书| 牵牛花的生长变化记录| 黄视频免费观看网站| 蔡雅同| 好男儿之情感护理| 免费看黄直播| 蜡笔小新日文| 那些回不去的年少时光演员表 | 安徽公共频道| 协议过户什么意思| 吉泽明步番号| 《瑜伽教练》第二季| 仁爱版九年级英语上册教案| 美国电影《贵夫人》| 《平凡之路》电影| 超薄轻舞玉女女裤广场舞| 水蜜桃蜜桃在线观看| 三年电影|