Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title></title>
- <style type="text/css">
- label {
- color: gray;
- }
- .focused {
- color: red;
- outline: 0;
- }
- </style>
- </head>
- <body>
- <form action="">
- <input type="checkbox" name="test" id="test" value="1" /> <label tabindex="0" hideFocus="true" for="test" id="labelTest">label</label>
- </form>
- <script type="text/javascript">
- var labelTest = document.getElementById('labelTest');
- labelTest.onfocus = function() {
- this.className = 'focused';
- }
- labelTest.onblur = function() {
- this.className = '';
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment