• 点击按钮时,显示不同的div内容


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">

    </style>

    </head>

    <body>

    <ul>
    <li ><a href="#" type="radio" name="sex" id="button1" onclick="show1()"> A</a></li>
    <li><a href="#" type="radio" name="sex" id="button1" onclick="show2()" >B</a></li>
    </ul>
    <div style="display:none" id="div1">
    <p>第一个DIV!</p>
    </div>
    <div style="display:none" id="div2">
    <p> 第二个DIV!</p>
    </div>

    <script>
    function show1(){
    document.getElementById("div1").style.display="block";
    document.getElementById("div2").style.display="none";
    };
    function show2()
    {
    document.getElementById("div2").style.display="block";
    document.getElementById("div1").style.display="none";
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    Lucene
    SQL优化以及索引
    Mysql优化
    RocketMQ
    RocketMQ
    Session共享
    Linux安装Nginx
    初识nginx
    跨域,防止表单重复提交
    HttpClient案例
  • 原文地址:https://www.cnblogs.com/leaflife/p/6735097.html
Copyright © 2020-2023  润新知