发表于: 2020-09-11 23:54:59

1 1147


今天完成的事情:

设置好页面1,页面2的html.css部分


        <script>
            // 获取传递玩家身份的数组allnum
            var allnum = localStorage.getItem("allnum");
            // 将字符串转换为数组,获取杀手,平民
            var arr = allnum.split(",")

            // 获取btn按钮
            var btn = document.getElementById("btn");

            // 查看身份数组
            console.log(allnum)
            // 查看身份数组的元素
            console.log(arr[0])
            // 查看数组的长度
            console.log(arr.length);

            // 获取mian节点
            var main = document.querySelector("main")


            window.onload = function () {
                //添加div
                for (index = 0index < arr.lengthindex++) {
                    // var boxs = document.createElement("div");//添加子节点div
                    // boxs.className = "boxs";//获取class为boxs
                    // main.appendChild(boxs);//把boxs添加到main中
                    var boxs = document.getElementById("boxs")//获取boxs的节点

                    var box = document.createElement("div");//添加boxs的子节点div
                    box.className = "box1";//获取css属性
                    boxs.appendChild(box);//把box添加到boxs中

                    var p1 = document.createElement("p");//添加文字节点
                    p1.className = "one";
                    box.appendChild(p1);
                    p1.innerHTML = arr[index];//添加玩家信息

                    var p2 = document.createElement("p");
                    p2.className = "two";
                    box.appendChild(p2);
                    p2.innerHTML = (index + 1) + "号";//玩家号数

                    var box2 = document.createElement("div");//添加节点的子节点
                    box2.className = "box2";
                    box.appendChild(box2);

                    var img = document.createElement("img");//添加图片节点
                    img.className = "img";
                    img.src = "./images/src/发言讨论结束,投票_04.png"//添加图组;
                    box2.appendChild(img);

                    console.log(index);
                    console.log(arr[index]);
                }

            }
            btn.onclick=function(){
                
            }
        </script>



           /* header */
            .nav-hand {
                height7rem;
                line-height7rem;
                displayflex;
                justify-contentspace-between;
                align-itemscenter;
                background-color#29bde0;
                colorwhite;
                font-size3.4rem;
                padding0 1vw;
                overflowhidden;
                text-overflowellipsis;
                white-spacenowrap;
            }

            main {
                margin2rem 2rem
            }

            .big-box {
                border1px solid #c9c9c9;
                background-color#f7f7f7;
            }

            .day {
                text-aligncenter;
                width100%;
                height8.8rem;
                line-height8.8rem;
                font-size3rem;
                border-bottom1px solid #c9c9c9;
                color#29bde0;
            }

            .process {
                positionrelative;

                width100%;
                displayflex;
                /* justify-content: space-between; */
                /* align-items: center; */
                colorwhite;
                padding-top2rem;
            }


            .img {
                width20%;
                displayflex;
                flex-directioncolumn;
                align-itemscenter;
            }

            .img img {
                padding1rem 0;
            }

            .img::before{
                positionabsolute;
                top0;
                content"";
                background-colorblue;
                width15px;
                height7px;
                border-radius0 0px 7px 7px;
                line-height7px;
            }

            .img::after {
                positionabsolute;
                top0;
                content"";
                border1px solid red;
                height100%;
                width1px;
            }

            .word {
                width60%;
                text-aligncenter;
            }

            .word div {
                positionrelative;
                line-height6rem;
                margin1rem 0;
                font-size3rem;
                background-color#24a7c6;
            }

            .word div::after {
                content'';
                positionabsolute;
                top14px;
                left-19px;
                border-top15px solid transparent;
                border-right19px solid red;
                border-bottom19px solid transparent;
            }

            footer {
                width100%;
                positionfixed;
                bottom0;
                height10vw;
                background-colorrgba(36167198.5);
                displayflex;
                justify-contentspace-between;
                align-itemscenter;
            }

            .btn1,
            .btn2 {
                width40%;
                margin0 5vw;
                height60%;
                bordernone;
                border-radius10px;
                colorwhite;
                font-size3vw;
            }

            .btn1 {
                background-color#f66f6f;
            }

            .btn2 {
                background-color#fbb425;
            }
        </style>
    </head>

    <body>

        <header>
            <div class="nav-hand">
                <img src="./images/第二天_03.png" class="box-one">
                <div>法官台本</div>
                <img src="./images/src/发言讨论结束,投票_02.png" class="box-three">
            </div>
        </header>

        <main>
            <div class="big-box">
                <div class="day">第一天</div>
                <div class="process-box">
                    <div class="process">
                        <div class="img">
                            <img src="./images/流程(第一天)_03.png" alt="">
                            <img src="./images/流程(第一天)_06.png" alt="">
                        </div>
                        <div class="word">
                            <div>杀手杀人</div>
                            <div>亡灵发表遗言</div>
                            <div>玩家依次发言</div>
                            <div>投票</div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <footer>
            <button class="btn1">结束游戏</button>
            <button class="btn2">法官日记</button>
        </footer>




返回列表 返回列表
评论

    分享到