当前位置: 代码迷 >> JavaScript >> 怎么让文本域滚动条到最下边的时候,按钮可按
  详细解决方案

怎么让文本域滚动条到最下边的时候,按钮可按

热度:113   发布时间:2012-04-07 17:31:50.0
如何让文本域滚动条到最下边的时候,按钮可按
想做个类似魔兽世界用户条例那种界面,把滚动条拉到最下边确定按钮才可以按.请各位达人指点一下.

------解决方案--------------------
<script>
function doit(){
t = document.form_name.ta.scrollTop;
h = document.form_name.ta.scrollHeight;
c = document.form_name.ta.clientHeight;
if((h-t) <=c) document.form_name.bt.disabled = false;
}
</script>
<form name= "form_name ">
<textarea name= "ta " rows= "5 " onscroll= "doit() ">
a
a
s
d
df
dsf
d
fdf
dsf
d
fd
</textarea>
<input type= "button " name= "bt " disabled= "true " value= "xxxxx ">
</form>
  相关解决方案