如何向下滚动页面以查看点击链接中的div [英] How to scroll down the page to view a div in a link clicked

查看:338
本文介绍了如何向下滚动页面以查看点击链接中的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < p> a href =index.html>< img src =images / logo2.pngalt =LOGO>< / a> 


< div>
< form method =POSTaction =signup.php>
< table>
< tr>
< td>名字< / td>
< td>< input type =textname =fname>< / input>< / td>
< / tr>
< tr>
< td>姓氏< / td>
< td>< input type =textname =lname>< / input>< / td>
< / tr>
< tr>
< td>电子邮件< / td>
< td>< input type =textname =email>< / input>< / td>
< / tr>
< tr>
< td>重新输入电子邮件< / td>
< td>< input type =textname =remail>< / input>< / td>
< / tr>
< tr>
< td>密码< / td>
< td>< input type =passwordname =pwd>< / input>< / td>
< / tr>
< tr>
< td>确认密码< / td>
< td>< input type =textname =cpwd>< / input>< / td>
< / tr>
< tr>
< td>生日< / td>
< td>< input type =textname =bday>< / input>< / td>
< / tr>
< tr>
< td>性别< / td>
< td>< input type =textname =sex>< / input>< / td>
< / tr>
< tr>
< td>< input type =submitvalue =Signup>< / input>< / td>
< td>< input type =buttonvalue =Cancel>< / input>< / td>
< / tr>
< / table>
< / form>
< / div>

当用户点击注册链接时,我需要向下滚动到div。
有人可以解释如何做到这一点。
提前得到... ...

解决方案

 < div>< a id ='form'><< a& ; / A> 
< form method =POSTaction =signup.php>
...
< / div>

然后你的链接如下:< a href =#表单>点击此处注册< / a>



解释:该链接转到 / code>锚点标记与 id 表格

In my html page, there exists a link to sign up and a div which holds the signup form.

<a href="index.html"><img src="images/logo2.png" alt="LOGO"></a>


<div>
            <form method="POST" action="signup.php">
                <table>
                    <tr>
                        <td>First Name</td>
                        <td><input type="text" name="fname"></input></td>
                    </tr>
                    <tr>
                        <td>Last Name</td>
                        <td><input type="text" name="lname"></input></td>
                    </tr>
                    <tr>
                        <td>Email</td>
                        <td><input type="text" name="email"></input></td>
                    </tr>
                    <tr>
                        <td>Re-enter Email</td>
                        <td><input type="text" name="remail"></input></td>
                    </tr>
                    <tr>
                        <td>Password</td>
                        <td><input type="password" name="pwd"></input></td>
                    </tr>
                    <tr>
                        <td>Confirm Password</td>
                        <td><input type="text" name="cpwd"></input></td>
                    </tr>
                    <tr>
                        <td>Birthday</td>
                        <td><input type="text" name="bday"></input></td>
                    </tr>
                    <tr>
                        <td>Sex</td>
                        <td><input type="text" name="sex"></input></td>
                    </tr>
                    <tr>
                        <td><input type="submit" value="Signup"></input></td>
                        <td><input type="button" value="Cancel"></input></td>
                    </tr>
                </table>
            </form>
        </div>

I need to scroll down to the div when the user clicks on the signup link. Can somebody plz explain how to do that. Thanx in advance....

解决方案

To use just HTML, you can use an anchor tag.

<div><a id='form'></a>
  <form method="POST" action="signup.php">
  ...
</div>

Then your link will be the following: <a href="#form">Click here to sign up</a>

Explanation: That link goes to the a anchor tag with the id of form.

这篇关于如何向下滚动页面以查看点击链接中的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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