WEB前端登录注册页面的form中使用placeholder占位符
2018-01-17 15:24
519 查看
在web的开发中有的时候我们需要用户登录注册页面
需要在输入框的里面有灰色字体进行提示
我之前都是使用复杂的JavaScript来实现
实现点击出现字符出现与消失
以及字符的颜色在灰色和黑色中变换
特别是密码输入框中需要涉及到两个输入框的显示与隐藏
非常麻烦
但是使用了placeholder占位符就不一样了
可以方便快捷的实现这个功能
示例代码:
需要在输入框的里面有灰色字体进行提示
我之前都是使用复杂的JavaScript来实现
实现点击出现字符出现与消失
以及字符的颜色在灰色和黑色中变换
特别是密码输入框中需要涉及到两个输入框的显示与隐藏
非常麻烦
但是使用了placeholder占位符就不一样了
可以方便快捷的实现这个功能
示例代码:
<body> <div id="div1"> <div style="position: relative;"> <img src="../img/headportrait-login-register.png" class="img1"> <input id="button_login" class="button1" type="button" value="登录" style="color:#E59A00" onclick="login_onclick()"> <input id="button_register" class="button1" type="button" value="注册" style="color: black;" onclick="register_onclick()"> </div> <div class="line"></div> <div id="user_register" style="display: none;"> <input placeholder="用户名" id="user_register_username" name="用户名" class="input1" type="text" /> <input placeholder="邮箱/手机号" id="user_register_contact" name="邮箱/手机号" class="input1" type="text" /> <input placeholder="密码" id="user_register_password" name="密码1" class="input1" type="password" /> <input placeholder="确认密码" id="user_register_ensurepassword" name="确认密码1" class="input1" type="password" /> <input placeholder="验证码" name="验证码" class="securitycode" type="text" /><input value="获取验证码" class="securitycode_made" type="button"><br> <input value="同意协议并注册" name="同意协议并注册" class="agreement" type="radio"><span class="agreement">同意协议并注册</span><br> <input value="注册" id="user_register_button" class="button2" type="button" onclick="ajax_user_register()" /> </div> <form id="merchant_register" style="display: none"> <input placeholder="用户名" value="" name="用户名" class="input1" type="text" /> <input placeholder="邮箱/手机号" value="" name="邮箱/手机号" class="input1" type="text" /> <input placeholder="密码" value="" name="密码3" class="input1" type="password" /> <input placeholder="确认密码" value="" name="确认密码3" class="input1" type="password" /> <input placeholder="验证码" value="" name="验证码" class="securitycode" type="text"><input value="获取验证码" class="securitycode_made" type="button"><br> <!-- style="color: #747474;"--> <div class="havefile" id="leftfile"> <input name="店铺门面照" class="file" id="photo" type="file"> <span class="infile">店铺门面照</span> </div> <div class="havefile" id="rightfile"> <input name="经营许可证" class="file" type="file"> <span class="infile">经营许可证</span> </div><br> <input value="同意协议并注册" name="同意协议并注册" class="agreement" type="radio"><span class="agreement">同意协议并注册</span><br> <input value="注册" type="submit" class="button2"> </form> <form id="login" style="display: block;"> <input placeholder="用户名/邮箱/手机号" id="login_username_email_mobilephone" name="用户名/邮箱/手机号" class="input2" type="text"> <input placeholder="密码" id="login_password" name="密码2" class="input2" type="password"> <input placeholder="验证码" name="验证码" class="securitycode" type="text"><input value="获取验证码" class="securitycode_made" type="button"><br> <input value="登录" type="button" class="button2" style="margin-top: 20px;" onclick="ajax_login()"> </form> <div> <input id="button_merchant" class="button1" type="button" value="商家" style="color: black;" onclick="merchant_onclick()"> <input id="button_user" class="button1" type="button" value="用户" style="color: rgb(229, 154, 0);" onclick="user_onclick()"> </div> </div> </body>
相关文章推荐
- MVC4.0 使用Form认证,自定义登录页面路径Account/Login
- 【web 回车】web项目 注册或登录页面 回车登录无效,解决方案
- Web前端-html页面-网易注册表单,美化及时验证效果
- 通过Ajax方式上传文件,使用FormData进行Ajax请求 博客分类: RESTful Web ServicesWeb前端开发
- [后端人员耍前端系列]KnockoutJs篇:使用WebApi+Bootstrap+KnockoutJs打造单页面程序
- 使用decj简化Web前端开发二:声明式表单增强和页面初始化
- NSURLSession GET 和 POST 使用步骤(注册页面的注册登录判断)
- JSP作业3 - 使用JSP实现简单的用户登录注册页面
- JSP作业4 - 使用JSP+JavaBean+Servlet实现用户登录注册页面
- [后端人员耍前端系列]KnockoutJs篇:使用WebApi+Bootstrap+KnockoutJs打造单页面程序
- 使用springboot创建web项目(一),登录页面
- Unity&WebForm(1): 自定义IHttpHandlerFactory使用Unity对ASP.NET Webform页面进行依赖注入
- tornado web高级开发项目之抽屉官网的页面登陆验证、form验证、点赞、评论、文章分页处理、发送邮箱验证码、登陆验证码、注册、发布文章、上传图片
- 使用ssh框架写一个基本的登录注册页面
- 使用Form验证,未登录时登录页面无法显示图片、css、js文件的解决方法
- 在前端页面中使用@font-face来显示web自定义字体【转】
- bootstrap前端框架使用modal弹出框form表单submit操作后解决页面提示不显示
- 使用HttpWebRequest和HttpWebResponse实现模拟登录需要登陆后才可以访问的页面
- Android程序员学WEB前端(4)-HTML(4)-注册页面-Sublime
- 使用ssh框架写一个基本的登录注册页面