如何让textbox的滚动条一直处在最下面,并且可以上下拖动!比如有好多数据,这时textbox就会显示一个垂直滚动条,我用atlas 0.5秒刷新一次页面这时就会出现一个现象:textbox的垂直滚动条就会不停的闪烁(一值向上走)如何定位滚动条让它在最下面,并且可以随便上下拖动它,就好像QQ那样!
解决方案 »
- 关于隐藏下载文件路径的问题[GridView]
- 将上传的图片放入image控件中显示,当图片宽高过大时,按比例放入image中。怎么实现?
- 请教ASP技术原理---ASP模块是在干些什么
- gridview从列表模式向编辑模式转换是怎么实现的啊
- 关于gridview一个很简单的问题,大家都来看看,散点分
- vb转c#的问题
- 连接access 数据库出错,帮我看看是什么原因?
- 问两个问题:1.在datagrid中如何为页眉加入背景图像 2.字符串显示的问题
- 关于iframe
- .net webservice 无法识别请求元素
- HttpWebResponse运行结果和IE直接执行不一样
- 简单..纯送分问题..Access数据库设计
/// <summary>
/// 浏览器滚动条总在下面
/// </summary>
public static void AlwaysDown()
{
StringBuilder winner = new StringBuilder();
winner.Append("<SCRIPT LANGUAGE=\"javascript1.1\">\n");
winner.Append("<!--\n");
winner.Append("\tvar autoScrollOn = 1;var scrollOnFunction;var scrollOffFunction;\n");
winner.Append("function scrollit()\n\t\t{if(!parent.d.document.inputform.as.checked){autoScrollOn=0;return true;}else {autoScrollOn=1;StartUp();return true;}}\n"); winner.Append("function scrollWindow()\n\t\t{if ( autoScrollOn == 1 ){this.scroll(0, 65000);setTimeout('scrollWindow()',50);}}");
winner.Append("function scrollOn()\n\t\t{autoScrollOn=1;\nscrollWindow();\n}");
winner.Append("function scrollOff()\n\t\t{autoScrollOn=0;}");
winner.Append("function StartUp()\n\t\t{this.onblur=scrollOnFunction;this.onfocus = scrollOffFunction;scrollWindow();}");
winner.Append("\tscrollOnFunction = new Function('scrollOn()')\n");
winner.Append("\tscrollOffFunction = new Function('scrollOff()')\n");
winner.Append("\t\tStartUp();\n");
winner.Append("\n//--></script> "); HttpContext.Current.Response.Write(winner.ToString());
}
#endregion
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title> <script type="text/JavaScript">
<!--
function scall(){
var textBox = document.getElementById("<%=TextBox1.ClientID%>")
textBox.scrollTop = textBox.scrollHeight
}function Button1_onclick() {
scall()
}function Button2_onclick() {
var textBox = document.getElementById("<%=TextBox1.ClientID%>")
textBox.value += "new Value\r\n"
scall()
}
window.onload=scall //-->
</script></head>
<body>
<form runat="server">
<asp:TextBox ID="TextBox1" runat="server" Columns="50" Rows="6" TextMode="MultiLine">
a
b
c
d
e
f
g
h
i
j
k
l
m
n
</asp:TextBox>
<br />
<input id="Button1" type="button" value="修改" onclick="return Button1_onclick()" />
<input id="Button2" type="button" value="添加内容 " onclick="return Button2_onclick()" />
</form>
</body>
</html>