• tabIndex 主要是美化tab键切换的体现


    原帖:http://www.cnblogs.com/rubylouvre/archive/2009/12/07/1618182.html

    跟随司徒正美兄的一个实践。

    window.onload = function(){
                
    var inputs = document.getElementsByTagName('input');
                
    for(var i=0, n=inputs.length; i<n; i++){
                    inputs[i].style.cssText 
    = 'background:#eee; border:1px solid #ccc;';
                    inputs[i].onfocus 
    = function(){
                        
    this.style.cssText = 'background:#7ecef4; border:1px solid #00a0e9;';
                    }
                    inputs[i].onblur 
    = function(){
                        
    this.style.cssText = 'background:#eee; border:1px solid #ccc;';
                    }
                }
            }

    HTML结构:

    <form name="myForm">
                
    <input tabindex="1" value="第一个">第一个<br />
                
    <input tabindex="3" value="第三个">第三个<br />
                
    <input tabindex="2" value="第二个">第二个<br />
                
    <input tabindex="5" value="第五个">第五个<br />
                
    <input tabindex="4" value="第四个">第四个<br />
                
    <input tabindex="6" value="第六个">第六个<br />
            
    </form>
  • 相关阅读:
    【jQuery日期处理】两个时间大小的比较
    CSS 盒子模型(Box model)中的 padding 与 margin
    如何优雅地制作精排 ePub —— 个人电子书制作规范及基本样式表
    异常处理 Exception
    Log4net
    HttpServerUtility类
    MVC 数据验证
    BigRender
    CSS中的块级元素与行级元素
    使用jQuery.form插件,实现完美的表单异步提交
  • 原文地址:https://www.cnblogs.com/jikey/p/1619157.html
Copyright © 2020-2023  润新知