类似focus的定位

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

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

None.gif if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //ITEM项
ExpandedBlockStart.gifContractedBlock.gif
            dot.gif{
InBlock.gif                
//有command的boundcolumn的控件转为LinkButton
InBlock.gif
                LinkButton _lb = (LinkButton)e.Item.Cells[0].Controls[0];
InBlock.gif
InBlock.gif                
//给此显示明细表的链接加入“明细表”定位的功能
InBlock.gif
                _lb.Attributes.Add("onclick","document.getElementById('zgrDetails').rows[0].scrollIntoView(); ");
ExpandedBlockEnd.gif            }

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

前台:

ExpandedBlockStart.gifContractedBlock.gifif (document.getElementById("zgrDetails"!= null)dot.gif{<%=ScrollScript%>}

后台代码:

None.gifprotected String ScrollScript
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif      
getdot.gifreturn m_scrollScript;}              
ExpandedSubBlockStart.gifContractedSubBlock.gif      
setdot.gif{ m_scrollScript = value;}
ExpandedBlockEnd.gif}

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

实现OK

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值