云主机测评网云主机测评网云主机测评网

云主机测评网
www.yunzhuji.net

HTML隐藏滚动条

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF8">
    <meta name="viewport" content="width=devicewidth, initialscale=1.0">
    <title>Contact Form</title>
    <style>
        body {
            fontfamily: Arial, sansserif;
        }
        form {
            width: 300px;
            margin: 0 auto;
        }
        input, textarea {
            width: 100%;
            marginbottom: 10px;
        }
        button {
            width: 100%;
            backgroundcolor: #4CAF50;
            color: white;
            padding: 10px;
            border: none;
            cursor: pointer;
        }
        button:hover {
            backgroundcolor: #45a049;
        }
    </style>
</head>
<body>
    <form id="contactform">
        <h2>Contact Us</h2>
        <input type="text" id="name" placeholder="Name" required>
        <input type="email" id="email" placeholder="Email" required>
        <textarea id="message" placeholder="Message" rows="5" required></textarea>
        <button type="submit">Submit</button>
    </form>
    <script>
        document.getElementById("contactform").addEventListener("submit", function(event) {
            event.preventDefault();
            var name = document.getElementById("name").value;
            var email = document.getElementById("email").value;
            var message = document.getElementById("message").value;
            if (name === "" || email === "" || message === "") {
                alert("Please fill in all fields.");
            } else {
                alert("Thank you for contacting us! We will get back to you shortly.");
                this.reset();
            }
        });
    </script>
</body>
</html>
(图片来源网络,侵删)
打赏
版权声明:主机测评不销售、不代购、不提供任何支持,仅分享信息/测评(有时效性),自行辨别,请遵纪守法文明上网。
文章名称:《HTML隐藏滚动条》
文章链接:https://www.yunzhuji.net/internet/155567.html

评论

  • 验证码