当位置样式为绝对时,滚动上的文本框定位问题
Textbox positioning issue on scroll when the position style is absolute
我在一个页面上有一个Asp:textbox(该页面也有一些不同的控件和div),我正在上面设置事件"onkeyup"上的style=position:absolute。并根据文本框中输入的Chartres动态增加其高度。但问题是,当用户向下或向上滚动页面时,文本框的位置始终保持固定。"在事件"onblur"上,我更改了style=position=",但当焦点在文本框上时,它会随着向上/向下滚动而移动。这是代码
<asp:TextBox ID="txtComment1" runat="server" Height="13px" Width="99%" MaxLength="40" TextMode="MultiLine"
onkeyup="SetHeight(this)" onblur="Blur(this)"></asp:TextBox>
<script type="text/javascript">
//Setheight function is used to change the style of position:"Absolute"
function Setheight(textscroll) {
textscroll.style.height = "14px";
textscroll.style.position = "absolute";
textscroll.style.width = "49%";
}
//Blur is used to again change the style position:""
function Blur(txtdesc1) {
txtdesc1.style.height = "14px";
txtdesc1.style.position = "";
txtdesc1.style.width = "99%";
}
</script>
附言:我试过HoverMenuExtender,但仍然有同样的问题
如果你想让一个html项目在滚动时跟随页面向下,请尝试position:fixed,这就是LinkedIn和FB等网站上所有粘贴页眉和页脚的工作方式。
相关文章:
- 复选框与文本内联-JS问题
- 使用Handontable在同一列中用纯文本和html对问题进行排序
- 轴助手上的标签与文本几何和旋转问题
- 高图表的文本溢出问题
- 有CSS问题:can't将文本放置在选择框的右侧
- Safari手机文本输入问题
- 从 tinymce 文本区域检索数据时出现问题
- 文本框导致结构 JS 中的字体出现问题
- 使用jquery问题将文本附加到文本区域
- 显示比容器宽的文本,滚动时出现问题
- Greasemonkey查找文本问题
- 循环进度条在滚动时显示 - 百分比文本问题
- 未终止的字符串文本问题
- Chrome 扩展程序输入文本问题
- 谷歌语音识别搜索文本问题
- Jquery CSS验证里面输入没有消息红色文本问题
- js自定义出借文本问题
- jQuery ie输入文本问题
- 操作栏文本问题
- 延迟和显示文本问题