第十章:作业

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>
相关推荐
zhanghaha13147 分钟前
Python语言基础:4_数据类型转换
java·前端·python
kyriewen13 分钟前
别再写useMemo了——2026年这5个React性能优化已经是反模式
前端·react.js·ai编程
OpenTiny社区14 分钟前
TinyRobot v0.5.0 新版本强在哪?
前端·vue.js·github
奇牙coding18 分钟前
gpt-5.6-sol 接入指南:reasoning_effort 参数配置、推理链验证与常见报错排查
前端·css·gpt·ai
larance25 分钟前
机器学习特征预处理之标准化/归一化
开发语言·python·机器学习
sugar__salt40 分钟前
Vue.js 前置知识:ES6+ 核心特性完全指南
前端·javascript·vue.js·vue·es6
农村小镇哥42 分钟前
C#中的字符串格式化
服务器·开发语言·c#
雪隐1 小时前
个人电脑玩AI-10让5060 Ti给你打工——我让 Claude Code 喝上了本地杂粮:Ternary-Bonsai-27B 部署历险记
前端·人工智能·后端
Bigger1 小时前
我受够了每天问“今天吃什么”,于是做了个 AI 菜单工具
前端·人工智能·agent
邢行行1 小时前
记一次 Three.js 踩坑:小球渲染出现诡异黑斑?原因竟然是这样...
前端