gpt4 book ai didi

javascript - 使用其 id 更改对象的字体系列

转载 作者:行者123 更新时间:2023-11-28 15:13:08 25 4
gpt4 key购买 nike

我需要使用其 id 更改特定对象的字体系列

有什么建议吗?

<script>
var day = new Date();
var today = day.getDate();
var lys = today * 16;
var heode = 505 - lys;

if (today == 24){
document.getElementById("chistmas").innerHTML ="Merry Christmas"
}
else {
let remainingdays = 24 - today;
document.getElementById("chistmas").innerHTML = "there are " + remainingdays + " days until christmas"
}
document.getElementsByClassName("light")[0].style.height=heode+"px"
</script>

最佳答案

您可以执行如下操作:

document.getElementById("chistmas").innerHTML ="<label style='font-family:Arial, Helvetica, sans-serif'>Merry Christmas</label>"

或者,

label.yourClassName {
font-family: "Times New Roman", Times, serif;
}

document.getElementById("chistmas").innerHTML ="<label class='yourClassName'>Merry Christmas</label>"

关于javascript - 使用其 id 更改对象的字体系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47690223/

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