请帮助我,我有一个包含链接的html
<a href="LoginandRegistration/Login_register.html#signup">Sign Up</a>
当我单击它时,我想将其右移到其他html
<div class="containerlogin">
<div class="avatarcontainer avatar">
<img src="avatar.jpg">
</div>
<div class="Loginbox">
<div class="form">
<form class="login-form" name="login">
<p>User Name</p>
<input type="text" placeholder="Enter Your Name"/><br>
<p>Password</p>
<input type="text" placeholder="Enter Your Password"/><br>
<input type="submit" value="Login"><br>
<p class="message">Create an account? <a href="#">Register</a></p>
</form>
<form class="register-form" name="signup">
<p>User Name</p>
<input type="text" placeholder="Enter Your Name"/><br>
<p>Password</p>
<input type="text" placeholder="Enter Your Password"/><br>
<p>Email</p>
<input type="email" placeholder="Enter Your Email"/><br>
<p>Phone number</p>
<input type="tel" placeholder="Enter Yo Telephone Number"/><br>
<p>Address</p>
<input type="text" placeholder="Enter Your Address"/><br>
<button>Create Account</button>
<p class="message">Alreday Have an account? <a href="#">Login</a></p>
</form>
</div>
</div>
</div>
JavaScript
<script src='https://code.jquery.com/jquery-3.3.1.js'></script>
<script>
$('.message a').click(function(){
$('form').animate({height:"toggle",opacity: "toggle"},"slow");
} )
</script>
这是表格
https://i.imgur.com/vg27sQo.jpg
https://i.imgur.com/ogEdgSY.jpg
我使用javascript将登录表单更改为注册表单,但是当我将LoginandRegistration/Login_register.html#signup
之类的链接放置到无法直接链接到注册表单的第一个html链接上时,它仍然链接到登录表单
请帮助我,谢谢。
答案 0 :(得分:0)
URL哈希是指向页面中与ID相关的锚点的链接-您需要将ID添加到表单中,例如:
<form class="register-form" name="signup" id="signup">
也就是说-我会做不同的事情-我只会显示url哈希标识的格式-而不是同时显示并滚动到所指示的形式。