第十章:作业

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>
相关推荐
用户69371750013841 分钟前
你每天用的 AI,可能真的被“投毒”了
前端·后端·ai编程
吴声子夜歌3 分钟前
Vue3——Vuex状态管理
前端·vue.js·vue·es6
qq_12084093714 分钟前
Three.js 工程向:Frustum Culling 与场景分块优化实战
前端·javascript
大肥羊学校懒羊羊4 分钟前
质因数个数问题:高效分解算法详解
开发语言·c++·算法
新缸中之脑5 分钟前
用Claude for Word审查法律合同
开发语言·c#·word
沐知全栈开发7 分钟前
SQLite 子查询
开发语言
漫游的渔夫9 分钟前
从 Fetch 到 RAG:为什么你的 AI 知识库总是“胡言乱语”?
前端·人工智能
Amos_Web11 分钟前
谷歌浏览器插件Brower-Books: 把整个浏览器变成你的云端书架
前端·chrome·产品
Codigger官方12 分钟前
生态破局:从孤岛工具到协同奇点
开发语言·人工智能·程序人生
莫逸风14 分钟前
【java-core-collections】B+ 树深度解析
android·java·开发语言