zoukankan      html  css  js  c++  java
  • Javascript 常用

    第一步,实现百度输入法的页面布局

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
        <title>百度输入法</title>
        <style>
    body,ul,li,button{margin:0;padding:0;}
    body{font:12px/1.5 Tahoma;}
    ul{list-style-type:none;}
    button{cursor:pointer;}
    #outer{width:70px;margin:10px auto;}
    #ime{margin-top:5px;background:#fff;border:1px solid #9a99ff;display:none;}
    #ime li{width:100%;line-height:24px;display:inline-block;vertical-align:top;}
    #close{border-top:1px solid #9a99ff;}
    #ime li a{color:#00c;padding:0 5px;display:block;text-decoration:none;}
    #ime li a:hover{background:#d9e1f6;}
    </style>
    </head>
    <body>
    <div id="outer">
    <button>输入法</button>
    <ul id="ime">
    <li><a href="javascript:;">手写</a></li>
    <li><a href="javascript:;">拼音</a></li>
    <li id="class"><a href="javascript:;">关闭</a></li>
    </ul>
    </div>
    </body>
    </html>

    第二步,用js实现功能

    <script>
    window.onload = function ()
    {
        var oBtn = document.getElementsByTagName("button")[0];
        var oIme = document.getElementById("ime");
        var oClose = document.getElementById("close");     
        var style = oIme.style;
        oBtn.onclick = function()
        {        
            style.display = style.display == "block" ? "none" : "block"
        };
        oClose.onclick = function()
        {
            style.display = "none"    
        }
    }
    </script>

    获取当前时间

    http://tylerfrankenstein.com/user/4/code/javascript-date-time-yyyy-mm-dd-hh-mm-ss

    http://jsfiddle.net/#&togetherjs=yIPGEeES1c

  • 相关阅读:
    arm64 boot
    python学习笔记
    字符编码问题详解
    Restful 架构设计
    调度器学习总结
    从0开始学习maven搭建spring+mybatis框架
    java内存管理
    linux 基础
    自学有感
    echart 图表显示技术
  • 原文地址:https://www.cnblogs.com/code-charmer/p/4028998.html
Copyright © 2011-2022 走看看