• 类似focus的定位


    有时如明细表,需要点一下定位到明细表具体的ITEM上,可以用

    document.getElementById("txtMeetingNo").scrollIntoView(); 来实现:) 比scrollTop这些好用,不过没有在FF等浏览器上测试过。

     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //ITEM项
                {
                    
    //有command的boundcolumn的控件转为LinkButton
                    LinkButton _lb = (LinkButton)e.Item.Cells[0].Controls[0];

                    
    //给此显示明细表的链接加入“明细表”定位的功能
                    _lb.Attributes.Add("onclick","document.getElementById('zgrDetails').rows[0].scrollIntoView(); ");
                }

    但是用这种方法,回发后刷新页面时定位重置,只能在JSCRIPT里进行处理,所以我只能这样做:

    前台:

    if (document.getElementById("zgrDetails"!= null){<%=ScrollScript%>}

    后台代码:

    protected String ScrollScript
    {
          
    getreturn m_scrollScript;}              
          
    set{ m_scrollScript = value;}
    }


    //定位明细表的script
    this.m_scrollScript = "document.getElementById('zgrDetails').rows[0].scrollIntoView();";
                    

    实现OK

  • 相关阅读:
    python之字典方法
    python之字符串方法
    python strip()方法使用
    Airtest自动化测试工具介绍
    selenium 环境配置
    一个自定义线程池的小Demo
    简单工厂模式
    BootStrap入门_创建第一个例子
    MongoDB的索引
    MongoDB的查询
  • 原文地址:https://www.cnblogs.com/syveen/p/233055.html
Copyright © 2020-2023  润新知