【发布时间】:2020-08-05 21:48:01
【问题描述】:
通过下面的代码,我试图让它响应静音和静音的输入。因此,当在文本框中输入静音或静音时,它会将颜色更改为红色(静音)和绿色(静音),在这种情况下,链接 ID 为 id="text" 和 "text1"。谢谢!
HTML:
<!DOCTYPE html>
<html>
<body>
<p>Write something in the text field to trigger a function.</p>
<input type="text" id="myInput" oninput="myFunction()">
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myInput").value;
document.getElementById("demo").innerHTML = "You wrote: " + x;
}
</script>
</body>
</html>
想要链接的 HTML:
<h1 class="l1-txt1 txt-center p-t-0 p-b-10">
<p id="text1" style="color:white; font-weight: 600"></p>
</h1>
<h1 class="l1-txt1 txt-center p-t-0 p-b-60">
<p id="text" style="color:crimson; font-weight: 600"></p>
</h1>
【问题讨论】:
标签: javascript html css telnet