提交页面的定位--scrollIntoView的用法
来源:互联网 发布:vc可视化编程 编辑:程序博客网 时间:2024/05/22 14:36
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... Platform Version Win16:4.0Win32:4.0Windows CE:4.0Unix:4.0Mac:4.0Version data is listed when the mouse hovers over a link, or the link has focus.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, XMPMove 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列
现在给出一种简单的办法(其他的一些利用锚点等办法都比较复杂)
{
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;绑定;
- 提交页面的定位--scrollIntoView的用法
- 提交页面的定位--scrollIntoView的用法
- 页面元素的定位scrollintoview
- scrollIntoView()的用法
- W3C DOM之scrollIntoView的用法
- 使用scrollIntoView方法定位页面元素---小结
- Javascript的scrollIntoView方法,控制页面锚点
- jsp页面提交验证 onSubmit的用法
- ScrollInToView方法(滚动页面)
- WPF 中listView.ScrollIntoView失效的问题
- 提交页面定位方法
- 使用scrollIntoView()进行内容定位
- 页面对象的定位
- 页面数据的提交
- ftl页面中表单提交的action的感叹号定位写法
- scrollIntoView
- scrollIntoView
- [前端] scrollIntoView 滚动当前元素,进入浏览器的可见区域
- 用Matrix类对显示对象应用仿射变换
- 不要让SQLServer自动转换害了你!
- 从今天开始,正式开通我的CSDN博客!
- fstream的用法
- 正则表达式过滤HTML危险脚本
- 提交页面的定位--scrollIntoView的用法
- 界面设计测试规范
- web打印
- 不刷新页面改变下拉菜单内容
- Windows XP中的命令行界面
- JS获取XML内容
- 关于Oracle学习以及DBA工作机会
- .net 操作XML小结
- ScopedVector