第十章:作业

html 复制代码
<!DOCTYPE html>  
<html>  
<head>  
    <meta charset="UTF-8">  
    <meta charset="UTF-8">  
    <title>数字时钟</title>  
    <style>  
        body {  
            display: flex;  
            flex-direction: column;  
            justify-content: center;  
            align-items: center;  
            height: 100vh;  
            margin: 0;  
            font-family: Arial, sans-serif;  
            background-color: #f0f0f0;  
        }  
 
        h1 {  
            font-size: 48px;  
            margin: 0;  
        }  
 
        .clock {  
            font-size: 64px;  
            font-weight: bold;  
            color: #333;  
        }  
 
        .label {  
            font-size: 24px;  
            margin-top: -10px;  
            color: #666;  
        }  
    </style>  
</head>  
<body>  
    <h1 class="label">数字时钟</h1>  
    <div class="clock" id="clock">00:00:00</div>  
 
    <script>  
        function updateClock() {  
            const now = new Date();  
            const hours = String(now.getHours()).padStart(2, '0');  
            const minutes = String(now.getMinutes()).padStart(2, '0');  
            const seconds = String(now.getSeconds()).padStart(2, '0');  
            document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds}`;  
        }  
 
        setInterval(updateClock, 1000);  
        updateClock(); // 初始化时钟  
    </script>  
</body>  
</html>
html 复制代码
<!DOCTYPE html>  
<html>  
<head>  
    <meta charset="UTF-8">  
    <title>禁止右键操作</title>  
    <style>  
        body {  
            display: flex;  
            flex-direction: column;  
            justify-content: center;  
            align-items: center;  
            height: 100vh;  
            margin: 0;  
            background-color: #f0f0f0;  
            font-family: Arial, sans-serif;  
        }  
 
        .message {  
            padding: 20px;  
            background-color: #fff;  
            border: 2px solid #333;  
            border-radius: 8px;  
            text-align: center;  
            font-size: 24px;  
            margin-bottom: 20px;  
        }  
 
        img {  
            max-width: 80%;  
            height: auto;  /* 自适应高度 */  
            border-radius: 8px;  
        }  
    </style>  
</head>  
<body>  
    <div class="message">请勿使用鼠标右键!</div>  
    < img src="img/cat.jpg" alt="猫咪图片" />  
 
    <script>
        document.body.oncontextmenu = function(event) {  
            event.preventDefault();   
            alert("禁止下载图片!");  
        };  
    </script>  
</body>  
</html>
相关推荐
HoweChenya几秒前
Gemma-4 实测:31B Dense 与 26B MoE 在 H20 上的性能分水岭
开发语言·php
Je1lyfish8 分钟前
Haskell 初探
开发语言·笔记·算法·rust·lisp·抽象代数
morethanilove8 分钟前
新建vue3 + ts +vite 项目
前端·javascript·vue.js
景庆1979 分钟前
vscode启动springBoot项目配置,激活环境
java·开发语言·vscode
GISer_Jing9 分钟前
微软AI战略全景:从基础设施到智能体生态
前端·人工智能·microsoft
幽络源小助理10 分钟前
PHP网站统计系统源码下载_极简统计程序支持宝塔部署_幽络源
开发语言·php
发际线向北11 分钟前
0x03 单元测试与Junit
前端·单元测试
忆往wu前12 分钟前
搞懂 SPA 再学路由!Vue Router 从0到完善 + 嵌套路由一次性梳理
前端·vue.js
小智社群13 分钟前
获取贝壳中介列表,并且自动导入excel
开发语言·javascript·ecmascript
Aliex_git13 分钟前
前端监控笔记(三)
前端·笔记·学习