Home > Web Front-end > JS Tutorial > js implements the effect of hiding the login box when the check box selects anonymous login_javascript skills

js implements the effect of hiding the login box when the check box selects anonymous login_javascript skills

WBOY
Release: 2016-05-16 15:44:58
Original
1438 people have browsed it

The example in this article describes the js implementation of hiding the login box when the check box selects anonymous login. Share it with everyone for your reference. The details are as follows:

This technique is relatively common. Some websites allow you to log in to post or post anonymously. When you check the checkbox to post anonymously, the login box is automatically hidden. Is it more user-friendly? This is actually a little bit of JavaScript code added to the form element. Please see the code for the specific implementation method.

The operation effect is as shown below:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-checkbox-nm-login-submit-codes/

The specific code is as follows:

<title>当复选框选择匿名登录时隐藏登录框</title>
<style>.a #login,#uname{display:none;}.a #uname{display:inline;}</style>
<body>
<div>
<span id="login">帐号:<input type="text" /> 密码:<input type="text" /> <input type="submit" value="登录" /></span>
<span id="uname">网友姓名:<input type="text" /></span>
<input type="checkbox" id="check" onclick="this.parentNode.className=this.checked&#63;'a':'';" />匿名</div>
</body>

Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template