如何滚动到文本框 [英] How to scrolldown to textbox

查看:71
本文介绍了如何滚动到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了à按钮和3个文本框,如何在单击按钮时编写代码向下滚动到第三个文本框automatecly?我试过按钮点击thirdtextbox.focus();但没有任何反应?有什么建议吗?我正在使用asp和c#

I have created à button and 3 textboxes how could i write code for when button is clicked scroll down to The third textbox automatecly? I have tried on button click thirdtextbox.focus(); But nothing happens? Any suggestion? I am using asp and c#

推荐答案

以下是关于如何使用jquery基于按钮单击滚动到文本框的快速而肮脏的示例。



它创建了一个名为scrollTo的简单插件,然后只需将click事件附加到每个链接/文本框。可能有一种更动态的方式来说明哪个链接滚动到哪个文本框但这可以满足你所需要的基础。



如果您有任何疑问,请告诉我们看看我是否可以提供帮助。



The below is a quick and dirty sample on how to scroll to a textbox based on a button click using jquery.

It creates a simple plugin called scrollTo and then just attach a click event to each link/text box. There is probably a more dynamic way of saying which link scrolls to which textbox but this does the basics of what you need.

If you have any questions let me know and ill see if i can help out.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script type="text/javascript">


.fn.scrollTo = function(){
返回this.each(function(){
.fn.scrollTo = function () { return this.each(function () {


(' html,body')。animate({
scrollTop:
('html, body').animate({ scrollTop:


这篇关于如何滚动到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆