潋澜海澈 发表于 2021-4-19 10:22

试帖3

<!DOCTYPE html>
<html>
    <head>
      <meta charset="UTF-8">
      <title></title>
      <style type="text/css">
            #a{
                width: 1000px;
                height: 500px;
                position: absolute;
                left: 200px;
                top: 400px;
                padding-top: 100px;
                background-color: black;
                border: 1px black solid ;
                text-align: center;
            }
            #no{
                position: absolute;
                left: 100px;
                top: 100px;
            }
      </style>
      <script>
            function a(){
                var no = document.getElementById("no");
                no.style.left = Math.floor(Math.random()*450)+"px";
                no.style.top = Math.floor(Math.random()*280)+"px";
            }
            function b(){
                alert("好玩吗? ")
            }
      </script>
    </head>
    <body>
      <div id="a" clas="a" style="color: red;">
            <span>写的也就一般对吧?</span><br />
            <button onclick="b()">yes</button><br />
            <button onmouseover="a()" id="no">no</button>
      </div>
    </body>
</html>

兰若 发表于 2022-3-30 21:18

亲爱的

潋澜海澈 发表于 2022-4-17 10:02

试什么呢亲爱的我手机看不了
页: [1]
查看完整版本: 试帖3