• JS检查当图片不存在时显示默认图片和键盘大小写键状态


    当图片不存在时显示默认图片

    1 <script type="text/javascript"> 
    2         var imgs = document.images; 
    3         for(var i = 0;i < imgs.length;i++){ 
    4             imgs[i].onerror = function(){ 
    5                 this.src = "http://images2015.cnblogs.com/blog/66516/201511/66516-20151104233425055-1712623285.png"; 
    6             } 
    7         } 
    8 </script>

    或者:

    1 <img src="" border="0" onerror="this.src=' http://images2015.cnblogs.com/blog/66516/201511/66516-20151104233425055-1712623285.png'"/>

    键盘大小写键状态

     1 <script type="text/javascript">
     2             function detectCapsLock(event) {
     3                 var e = event || window.event;
     4                 var o = e.target || e.srcElement;
     5                 var oTip = o.nextSibling;
     6                 var keyCode = e.keyCode || e.which; // 按键的keyCode 
     7                 var isShift = e.shiftKey || (keyCode == 16) || false; // shift键是否按住
     8                 if (
     9                     ((keyCode >= 65 && keyCode <= 90) && !isShift) // Caps Lock 打开,且没有按住shift键 
    10                     || ((keyCode >= 97 && keyCode <= 122) && isShift)// Caps Lock 打开,且按住shift键
    11                 ) {
    12                     oTip.style.display = '';
    13                 }
    14                 else {
    15                     oTip.style.display = 'none';
    16                 }
    17             }
    18  
    19             window.onload = function () {
    20                 document.getElementById('<%= txtUserName.ClientID %>').focus();
    21                 document.getElementById('<%= txtPassword.ClientID %>').onkeypress = detectCapsLock;
    22             };
    23 </script>
  • 相关阅读:
    vpp + vxlan
    vpp + frrouting
    VPP + vxlan
    dpdk: Unsupported PCI device 0x19e5:0x0200 found at PCI address 0000:05:00.0
    How-to: Build VPP FD.IO with Mellanox DPDK PMD on top CentOS 7.7 with inbox drivers.
    vpp[73384]: register_node:485: process stack: Invalid argument (errno 22)
    鲲鹏920上vpp--dpdk编译
    编译frr--python版本问题--Python-3.7.7
    安装vpp
    Go排序
  • 原文地址:https://www.cnblogs.com/huangjianwu/p/4536131.html
Copyright © 2020-2023  润新知