随机文案生成器:配图创意灵感
<!DOCTYPE html>
<html>
<head>
<title>随机文案生成器:配图创意灵感</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
h1 {
font-size: 2.5rem;
text-align: center;
margin-top: 2rem;
}
.container {
max-width: 800px;
margin: 0 auto;
text-align: center;
padding: 2rem;
}
img {
max-width: 100%;
margin-bottom: 1rem;
}
button {
font-size: 1.2rem;
padding: 0.5rem 1rem;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}
</style>
</head>
<body>
<h1>随机文案生成器:配图创意灵感</h1>
<div class='container'>
<img id='image' src='https://picsum.photos/400/300' alt='随机图片'>
<p id='text'>点击下面按钮生成随机文案</p>
<button id='generate' onclick='generateText()'>生成</button>
</div>
<script>
function generateText() {
var texts = [
'生活不是要超越别人,而是要超越自己。',
'人生就像一盒巧克力,你永远不知道下一颗是什么。',
'永远不要放弃自己想要的东西。',
'不要让过去的悲伤影响你的未来。',
'世界上没有绝对的公平,只有相对的公平。',
'幸福不是得到你想要的一切,而是享受你拥有的一切。',
'不要害怕失败,因为失败是成功之母。',
'只有经历过痛苦,才能真正领悟幸福的来之不易。',
'成功不是偶然的,而是必然的。'
];
var randomIndex = Math.floor(Math.random() * texts.length);
var text = texts[randomIndex];
document.getElementById('text').innerHTML = text;
document.getElementById('image').src = 'https://picsum.photos/400/300?' + Math.random();
}
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/mIOI 著作权归作者所有。请勿转载和采集!