设置多行 TextBox 滚动条位置

多行 TextBox 刷新后默认回到首行,通过设置 txt.scrollTop  =  txt.scrollHeight 强制滚动尾行:

<% @ Page Language = " C# "   %>

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

< html  xmlns ="http://www.w3.org/1999/xhtml" >
< head  runat ="server" >
    
< title ></ title >
</ head >
< body >
    
< form  id ="form1"  runat ="server" >
    
< div >
    http://topic.csdn.net/u/20090220/10/92760759-6e9c-4cf2-8660-c2fb5cf004f0.html?seed=1331838345
        
< asp:TextBox  ID ="TextBox1"  runat ="server"  TextMode ="MultiLine"  Rows ="10"  Columns ="10" >
    * 移动开发者自己的聚集地
    * 『送』千元开发板,嵌入式开发热招!
    * 构建出色多核应用程序
    * CSDN网友快速赚分技巧
    * IBM dW精华技术,开发者必看
    * 走进嵌入式学院,就业世界500强
    * 财富两千强公司都选甲骨文SOA解决方案
    * CUDA—大规模并行计算的利器
        
</ asp:TextBox >         
        
< script  type ="text/javascript" >
            window.onload 
=   function () {
                
var  txt  =  document.getElementById( " TextBox1 " );
                document.body.focus();
                txt.scrollTop 
=  txt.scrollHeight;         //  IE, FF                
                 // txt.focus(); // FF#OK, IE#Resume to Top
            }
        
</ script >
    
</ div >
    
</ form >
</ body >
</ html >
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值