gpt4 book ai didi

javascript - 在网页上列出电子邮件地址

转载 作者:行者123 更新时间:2023-11-28 14:28:59 26 4
gpt4 key购买 nike

我正在尝试通过 css 着色和更改字体大小,但它不起作用。以下是我写的,但它不起作用,我不知道问题出在哪里。欢迎任何想法?

JavaScript

<script>
emailA = 'thestation.com'
emailA = ('jason' + '@' + emailA)
document.write('<a href="mailto:' + emailA +'">' + emailA +'</a>')
</script>
<br>

<script>
emailB = 'thestation.com'
emailB = ('arnold' + '@' + emailB)
document.write('<a href="mailto:' + emailB +'">' + emailB +'</a>')
</script>
<br>

<script>
emailC = 'thestation.com'
emailC = ('vincent' + '@' + emailC)
document.write('<a href="mailto:' + emailC +'">' + emailC +'</a>')
</script>
<br>

<script>
emailD = 'thestation.com'
emailD = ('paul' + '@' + emailD)
document.write('<a href="mailto:' + emailD +'">' + emailD +'</a>')
</script>

CSS

.emailA {
font-size: 2em;
color: green;
}
.emailB {
font-size: 3em;
colour: green;
}
.emailC {
font-size: 4em;
colour: green;
}
.emailD {
font-size: 5em;
colour: green;
}

HTML

<div class="emailA"></div>
<div class="emailB"></div>
<div class="emailC"></div>
<div class="emailD"></div>

最佳答案

您根本没有在 HTML 中使用 div。尝试像这样在每个 a 元素中添加类

document.write('<a href="mailto:' + emailA +'" class="emailA">' + emailA +'</a>')

您将看到样式正确的链接。

关于javascript - 在网页上列出电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54349294/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com